Hi,

2011/1/6 René Dudfield <[email protected]>:
> Hi,
>
> are the thread GIL releasing functions going to be supported in pypy
> with CPyExt?
>
> To allow this usage:
>
> PyThreadState *_save;
> _save = PyEval_SaveThread();
> // ...Do some blocking I/O operation, or CPU intensive operation that
> does not use the python api...
> PyEval_RestoreThread(_save);
>
> Or using the macros...
>
> Py_BEGIN_ALLOW_THREADS;
> // ...Do some blocking I/O operation, or CPU intensive operation that
> does not use the python api...
> Py_END_ALLOW_THREADS;
>
> Is it not possible or too hard, or is it just not implemented yet?

Frankly, I even don't know.
At least, the Py_BEGIN_ALLOW_THREADS macros are there and will compile.

OTOH it seems that every call from the pypy interpreter to C releases the GIL,
and that conversely, every call from to a Python API function will
grab the GIL for the duration of the call (yes, even Py_INCREF)
cpyext is maybe already thread-safe, only awfully slow...
But this is just a guess, from looking at the source code.

I'd be grateful if you could write a custom module and do some tests
in this area,
with and without the Py_BEGIN_ALLOW_THREADS calls.

Cheers,

-- 
Amaury Forgeot d'Arc
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to