ANN: Stackless Python 0.2

Tim Peters Tim.Peters at p98.f112.n480.z2.fidonet.org
Tue Jun 29 03:56:59 EDT 1999


From: "Tim Peters" <tim_one at email.msn.com>

> ...
> Py_BEGIN_ALLOW_THREADS
> ThreadedSpam();
> Py_END_ALLOW_THREADS
>
> it's-only-confusing-if-you-think-about-it-too-much<wink>-ly y'rs  - tim

[Robin Becker]
> so do I then have to poll ThreadedSpam myself to see if it's finished or
> is there a python api version of mutexes/locks etc.

You're in C now -- you do anything you need to do, depending on the
specifics of ThreadedSpam (which was presumed to be a pre-existing
thread-safe C routine).  The snippet above clearly assumes that ThreadedSpam
"is finished" when it returns from the call to it.  If your flavor of
ThreadedSpam doesn't enjoy this property, that's fine too, but then you do
whatever *it* requires you to do.  This is like asking me whether the right
answer is bigger than 5, or less than 4:  how the heck should I know <wink>?

You can certainly use Python's lock abstraction in your own C code, but it's
unlikely a pre-existing C function is using that too.

python-doesn't-restrict-what-c-code-can-do-except-to-insist-that-it-
    acquire-the-lock-before-returning-to-python-ly y'rs  - tim







More information about the Python-list mailing list