On 29 September 2010 06:21, Stephane DROUARD <[email protected]> wrote:
> Lisandro Dalcin wrote:
>
>> OK, many thanks. Not sure if I'll push it right now, I'm still
>> thinking about other issue we need to handle
>>(http://bugs.python.org/issue9972)
>
> Wouldn't something like that solve the issue:
>
> #ifdef WITH_THREADS
>  #define __Pyx_PyGILState_Ensure()   PyGILState_Ensure()
>  #define __Pyx_PyGILState_Release(s) PyGILState_Release(s)
> #else
>  #define __Pyx_PyGILState_Ensure()   PyGILState_LOCKED
>  #define __Pyx_PyGILState_Release(s)
> #endif
>
> To be used like:
> PyGILState_STATE state = __Pyx_PyGILState_Ensure()
> ...
> __Pyx_PyGILState_Release(s)
>
> Note that you may get a warning saying that state is not used in non-thread 
> mode.
>
> Stephane
>

Yes, I'm using something very similar:

http://code.google.com/p/mpi4py/source/browse/trunk/src/atimport.h#290

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to