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 threads.
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. -- http://mail.python.org/mailman/listinfo/python-list