On Mon, 2007-11-05 at 22:12 -0800, Tony Cappellini wrote:
> Everything I've read about threading usually starts off
with
>
> "Don't use the thread module, use threading
instead."
This philosophy is simply that 'threading' provides a higher
level
interface (with more object-oriented features) than
'Thread'. There's
nothing inherently wrong with Thread; it's simply a rather
low level
interface with only basic facilities. threading adds
features to create
Thread objects on which you can 'wait' or check is the
thread is still
alive etc.
>
> "calls to sleep() block", (don't call sleep
when using python threads)
Well by definition, calls to sleep *should* block the
calling thread!
However, sleep also releases the global interpreter lock,
allowing other
threads to run while the sleeping thread err.. sleeps. I
can't see any
reason why sleep() and threads are incompatible.
HTH
BC
>
> When I looked at the Thread demo for wx, I was
surprised to see
> import thread
> There are also calls to sleep in the wx thread demo.
>
> This demo is doing just what the python multi-threading
resources
> state not do do,
> but I don't understand why.
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|