On Sep 7, 3:42 pm, sturlamolden <sturlamol...@yahoo.no> wrote:
> On 7 Sep, 07:17, grbgooglefan <ganeshbo...@gmail.com> wrote:
>
> > What is best way to embed python in multi-threaded C++ application?
>
> Did you remeber to acquire the GIL? The GIL is global to the process
> (hence the name).
>
> void foobar(void)
> {
>     PyGILState_STATE state = PyGILState_Ensure();
>
>     /* Safe to use Python C API here */
>
>     PyGILState_Release(state);

You can't use that in this case as they specifically are talking about
a interpreter per thread, which implies creating additional sub
interpreters. The simplified GIL state API you mentioned only works
for threads operating in the main (first) interpreter created within
the process.

The OP can do what they want, but they need to user lower level
routines for creating their own thread state objects and acquiring the
GIL against them.

Graham
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to