Hello all,
I'm embedding Python in my C application. The application makes several
calls to PySys_WriteStdout from the main thread and so far it's ok.
A problem occurs when I'm creating another thread (in Windows with
CreateThread) and trying to call PySys_WriteStdout from there; at the
first try it crashed.

I've added some locking calls and now the code looks like this (from
the thread):
PyEval_AcquireLock();
PyThreadState *interp = Py_NewInterpreter();
PyThreadState_Swap(interp);

PySys_WriteStdout("write somthing...");

PyEval_ReleaseThread(interp);
PyEval_ReleaseLock();

Well the code does not crash now, but it doesn't display anything in
Python's console. If I call PySys_WriteStdout from the main thread it
does display alright.

Any ideas how I can get PySys_WriteStdout to work within a thread?
tnanks,
Eli

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

Reply via email to