Python 2.0 and Stackless

Will Ware wware at world.std.com
Mon Aug 7 18:47:49 EDT 2000


Toby Dickenson <mbel44 at dial.pipex.net> writes:
> def m(y):
>    x()
>    try:
>       y()
>    finally:
>       z()
> Today I can be sure that a call to z is always preceeded by a single
> call to x. Stacklessness makes that assumption false.

David Bolen (db3l at fitlinxx.com) wrote:
> Um, of course unless multiple threads are involved, in which case your
> naive function may be interrupted between its calls to x() and z() and
> some other routine may call x() in between, right?

When running stackless-based threads, this is true. It is also true for
OS threads. If x() has side-effects (e.g. changes global variables)
then you need to be aware of that possibility, and it may be appropriate
to wrap a semaphore around m(y).
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list