[pypy-dev] pypy c++ embedding multithread GIL

Armin Rigo armin.rigo at gmail.com
Mon Oct 24 03:37:56 EDT 2016


Hi,

On 20 October 2016 at 05:58, 手游引擎组|田凯 <tkn0313 at corp.netease.com> wrote:
> c++ code: (thread func, multi thread will call cpp_work)
> void cpp_work()
> {
> //how to get pypy GIL ( I ues PyGILState_Ensure but blocked here for ever)
> work_callback() //call python func
> //release GIL (PyGILState_Release(state)
> }

You don't explain how ``work_callback()`` calls the Python function.
Maybe it is a CFFI callback?  In that case, the GIL is acquired
automatically and you should not call any of the PyXxx functions from
the CPython C API.


A bientôt,

Armin.


More information about the pypy-dev mailing list