Detached interpreter threads

The Dark Seraph chris at acheris.net
Thu May 27 17:42:52 EDT 2004


Hi-

I am writting an application in C++ that I am attempting to embed an
interpreter in.  I know about how I need to protect the interpreter
internals from mean nasty threads in my program, but I am runnning
across a problem I don't quite understand.

Here is my flow of control:

C++ Main starts up
Py_Initialize() is run
PyEval_InitThreads() is run ( or whatever it is called )  
PyRun_SimpleFile() is called with Loader.py
Loader.py begins to execute:
	Loader.py prints it is running
	Loader.py does a few imports
	Loader.py does a start_new_thread()
	Loader.py says it is done running
Control returns to C++ program

The problem is that the new thread started by Loader doesn't every
have its entry point called.  I made the very first line a print,
but that didn't ever get executed.  If I run Loader.py on its own, it
works just fine and dandy.  I have the same construct in Jython that
works perfectly, so I am kind of puzzled as to why interpreter threads
don't run.

Any thoughts?

-- 
chris at acheris.net			|  Fight Censorship, Boycott Wal-Mart
		Now is the winter of your discontent! - Stewie



More information about the Python-list mailing list