using python interpreters per thread in C++ program
graham.dumpleton at gmail.com
Mon Sep 7 12:49:00 CEST 2009
On Sep 7, 6:47 pm, ganesh <ganeshbo... at gmail.com> wrote:
> On Sep 7, 3:41 pm, Graham Dumpleton <graham.dumple... at gmail.com>
> > On Sep 7, 3:42 pm, sturlamolden <sturlamol... at yahoo.no> wrote:
> > interpreters. The simplified GIL state API you mentioned only works
> > for threads operating in the main (first) interpreter created within
> > the process.
> I modified my program to have Py_Initialize and compilation of one
> Python function done in main() thread. Then I am calling only that
> function in callPyFunction() thread. But, this thread does not come
> out of PyGILState_Ensure() function.
> > 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
> What are the "lower level routines" for creating own thread state
> objects & acquiring GILs.
> Also, where can I find more information about those routines?
Documentation is at:
Are you really using sub interpreters though? There is no evidence of
that in the code you posted earlier.
Sure you just don't understand enough about it and so are using the
wrong terminology and all you really want to do is run externally
created threads through the one interpreter.
Using sub interpreters is not for the feint of heart and not something
you want to do unless you want to understand Python C API internals
More information about the Python-list