]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr: use new Gil class in place of PyGILState_*() API
authorTim Serong <tserong@suse.com>
Fri, 12 May 2017 12:24:19 +0000 (22:24 +1000)
committerTim Serong <tserong@suse.com>
Mon, 22 May 2017 06:52:48 +0000 (16:52 +1000)
commitf36b0d9d4053e167f59b89286cc9378e8e1563f7
treefc09db3107d8290b4fb177a84d1bc9505397cd35
parentc89bbd66b67937e88bbb7b5d84d4f2489a837c1e
mgr: use new Gil class in place of PyGILState_*() API

Prep work for loading modules in separate python sub-interpreters.
According to the Python C API docs, mixing the PyGILState_*() API
with sub-interpreters is unsupported, so I've replaced these calls
with a Gil class, which will acquire and release the GIL against
a specific python thread state.

Note the manual python thread state creation in MgrPyModule::serve().
The PyGILState_*() APIs would have done that for us, but we're not
using them anymore, so have to do it by hand (see
https://docs.python.org/2/c-api/init.html#non-python-created-threads
for some description of this).

Signed-off-by: Tim Serong <tserong@suse.com>
src/mgr/Gil.h [new file with mode: 0644]
src/mgr/MgrPyModule.cc
src/mgr/MgrPyModule.h
src/mgr/PyModules.cc
src/mgr/PyModules.h
src/mgr/PyState.cc