[SciPy-user] Multithreading cookbook entry

Lou Pecora lou_boog2000@yahoo....
Thu Feb 21 18:02:00 CST 2008

--- Thomas Heller <theller@ctypes.org> wrote:

> Of course does ctypes release the GIL on foreign
> function calls.  And the GIL
> is acquired if Python implemented callback functions
> call back into
> Python code.

I'm sorry, I don't understand what you just said.  Can
you restate it?  I will also check the ctypes docs.

> There is nothing that ctypes needs to know about the
> C function - if the
> C function is not thread safe, you must not call it
> from other threads.

How do I tell if the C function is thread safe?

> Except - if the C function makes Python api calls,
> however, the GIL must not be
> released.  In this case you should use the Python
> calling convention; for details
> look up the docs (pydll and such).

My C function will make NO Python API calls. Can I
just call the Py_BEGIN_ALLOW_THREADS and
Py_BEGIN_ALLOW_THREADS macros in the C function to
allow return to another thread while the C function
calculates?  Can the C function be called for another
thread?  There are lots of docs.  Which do you suggest
for me?  

-- Lou Pecora,   my views are my own.

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

More information about the SciPy-user mailing list