Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10646 > unrolled thread

Re: Quick question about threads and interpreters.

Started byChris Angelico <rosuav@gmail.com>
First post2011-08-01 06:57 +0100
Last post2011-08-01 06:57 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Quick question about threads and interpreters. Chris Angelico <rosuav@gmail.com> - 2011-08-01 06:57 +0100

#10646 — Re: Quick question about threads and interpreters.

FromChris Angelico <rosuav@gmail.com>
Date2011-08-01 06:57 +0100
SubjectRe: Quick question about threads and interpreters.
Message-ID<mailman.1711.1312178264.1164.python-list@python.org>
On Mon, Aug 1, 2011 at 6:04 AM, Ira Gray <tkjthingone@gmail.com> wrote:
> I come along, write a .DLL and throw it into the program. My .dll has its
> own thread (right?),

Not unless you actually create one. A DLL is simply a puddle of code;
the application calls your code, you do whatever you do, you return.
At no time will this start another thread, unless you explicitly do
so.

I think the easiest way to do what you're talking about is to keep it
all on the same thread, and then call back into Python. Use the same
global and local dictionaries, and then the Python namespace will be
common across both your original code and the code your DLL is
invoking - which will allow you to call that "existing functionality"
you referred to.

You will have to be careful to ensure that your DLL calls into the
exact same Python library that the main application is. This might be
a bit tricky, if you're not 100% sure of where your DLL is going to be
called from. It might be easier and safer to have your parent program
actually provide a function pointer to the DLL, which the DLL can then
use to call on Python; that way, there's no direct linkage from your
DLL to the Python library.

Chris Angelico

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web