From: Ray K. <rh...@ne...> - 2000-10-08 14:25:13
|
Jan Ekholm wrote: > > On Sat, 7 Oct 2000, Ray Kelm wrote: > > >Actually, at least for version 1.5.2, python threading uses a single > >lock for the interpreter, so only one thread of python code will run > >at a given time. When you enter a blocking call (like read, select, > >etc) the C code for that function has to release the interpreter lock. > > Urgh. Well, I'll try and see anyway. I use 2.0, so there may be some > changes. Personally I'd think it's silly for all threads to be suspended > just because one thread does some blocking call. If it doesn't work out > I've at leats learnt something about Python threading in the process. Maybe I didn't explain that well enough. The C code that performs the blocking functions in python *releases* the lock, so that other threads can run. One thread doesn't block other threads, unless the C code that contains a blocking call does not release the lock, which is what pysdl does right now. It can be fixed. I know there was an patch for 1.5.2 (called "microthreading" I think) to improve the granularity of the threading in python. It's possible that 2.0 has incorporated that patch. -Ray the granulat |