using python interpreters per thread in C++ program
ganeshborse at gmail.com
Mon Sep 7 13:53:10 CEST 2009
Actually, I modified my program to have a single shared Py-interpreter
across all threads to test the usage of GIL. So, I did Py_Initialize
in main() function and only called that python function in different
But this is not the way I want to use interpreters in my code.
I am looking for using sub-interpreters, only that I did not know this
this term, till you mentioned it here.
So bvefore this, I was calling py_Initialize in each of the C++ level
threads, which was wrong.
I should be using Py_NewInterpreter() in my threads and Py_Initialize
() in main() thread. Please correct me if I am wrong.
>>>>not something you want to do unless you want to understand Python C API internals very well.
Are these APIs really tricky to use with C++ embedding? Can't they be
implemented thru C APIs?
I need to use these to get the proper concurrency in my multi-threaded
application without any synchronization mechanisms.
More information about the Python-list