Hi,
Maybe you already fixed the issue, but for the record, I've got the same
problem and finally it turned out that I was calling PyEval_InitThreads twice
and also after fixing that, I also had to move the call to PyEval_ReleaseLock(); at the end of the entire initialization (not just after PyEval_initThreads).
The key thing there is to follow:
<<at initialization thread>>
Py_Initialize ();
PyEval_InitThreads();
/* now call here to initialize all python code by loading external files
or internal module loading (i.e. Py_InitModule3) */
/* ..and now, once no more Python C/API call is required, release
the GIL so other threads can come into play */
PyEval_ReleaseLock ();
<<and now, from other threads, use>>
/* wait til gil acquired */
state = PyGILState_Ensure();
/* your code */
/* release GIL */
PyGILState_Release (state);
Hope it helps, Cheers!