Quick question about threads and interpreters.

Ira Gray tkjthingone at gmail.com
Mon Aug 1 01:04:10 EDT 2011


Lets say I have a program that is running a python interpreter in the main
thread.

I come along, write a .DLL and throw it into the program. My .dll has its
own thread (right?), separate from the main thread, and then makes a
pyrun_simplestring call to the pythonxx.dll. The pyrun_simplestring call
attempts to make contact with a function in the original python program. In
short, I'm attempting to leverage existing functionality in the original
python program from my .DLL.
I'm sure that sounds confusing, so maybe: PythonInterpreter_MainThread is
running some SourceCode, MyDLL_PyRun_SimpleString_OtherThread makes call(?)
to the same SourceCode.

Now, my question is: What happens? Is another python interpreter instance
created in my .dll thread to handle that call? is my call 'separate' from
the main thread interpreter? I'm hoping someone can point me towards some
material to better understand what might happen if I did what I outlined
above. It's a small school project (not homework, just a "hey, remember when
I asked you about blahblah, well I got it working!") and I'd appreciate any
guidance I could get into the dark arts of multiple threads and how they
relate to python interpreters, and if multiple python interpreters are
created (one for each thread) how making calls to the same code works.

Thank you for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110731/c622fa00/attachment.html>


More information about the Python-list mailing list