need some help with threading module...

chahnaz.ourzikene chahnaz.ourzikene at
Thu Dec 30 23:33:00 CET 2004

"M.E.Farmer" <mefjr75 at> a écrit dans le message de news:
1104431262.457172.295520 at

> What did you expect? This is what it did on win 2000/python 2.2.3
> ######> controller waiting...  0 loops
> ######> controller waiting...  1 loops
> Subject : the counter is now 0
> ######> controller waiting...  2 loops
> Subject : the counter is now 1

Yeah, looking to the trace i can easily say you have executed it from IDLE,
because IDLE is so slow that threads can have IRQs.
Try to execute it directly from a shell under windows, and you will see that
the Subject thread has much more CPU time thant the Controller thread.
Because Subject does his job in a loop, and have no sleep call inside its
code. Controller sleeps a while to let Subject run a little on the CPU.

Now try to run it under Linux directly from the shell and you'll have much
more time for Subject and very less for Controler. If you run it from IDLE
it can be a little more parallel.

Now there's a strange behaviour on my machine when i run my script within
IDLE under Windows : IDLE idles and never stops runnig !! i ran the same
script from a shell and it's all perfect...

Very strange..

Yacine Chaouche -- France

> It seems to be what you were trying to do.
> M.E.Farmer

More information about the Python-list mailing list