[Python-Dev] POSIX thread code

Gerald S. Williams gsw@agere.com
Thu, 28 Feb 2002 08:47:42 -0500


Tim Peters wrote:
> Please use current CVS Python for patches.  For example, all the "sema" code
> no longer exists (it was undocumented and unused).

DOH! Sorry, I thought of that after pressing SEND. I had
been using a specific Cygwin version to relay and test the
proposed changes.

DOH again! I just realized that a thread_nt.h patch that I
submitted to the patch manager has the same problem!

I'd better go get the latest CVS sources before commenting
any further about the code...

You and Martin have good points about the implementation,
some of which I had intended to address once I knew which
implementation to target.

It sounds like I'll be targetting the general POSIX thread
version of Python's thread interface code. I'd definitely
at least check for _POSIX_SEMAPHORES before changing the
behavior, though.

One question left is whether to continue calling the file
thread_pthread.h or to rename it thread_posix.h.

> /* Thread package.
>    This is intended to be usable independently from Python.
> 
> That's why there are no calls to Python runtime functions in
> thread_pthread.h (etc) files now; e.g., they call malloc() and free()
> directly, and don't reference any PyExc_XXX symbols.  That's a lot to
> overcome just to break existing code <wink>.

Actually, this isn't true. The current thread_nt.h creates
a Python dictionary to keep track of thread handles. This
was what my earlier patch was for--the dictionary isn't
even used (and creates a memory leak to boot). I proposed
removing it entirely (along with the #include <Python.h>).
I'll update my previous patch with one based on current
CVS sources.

-Jerry

-O Gerald S. Williams, 22Y-103GA : mailto:gsw@agere.com O-
-O AGERE SYSTEMS, 555 UNION BLVD : office:610-712-8661  O-
-O ALLENTOWN, PA, USA 18109-3286 : mobile:908-672-7592  O-