Python Threading front end

Andrew Bennetts andrew-pythonlist at puzzling.org
Sat Feb 1 02:09:06 CET 2003


On Fri, Jan 31, 2003 at 04:36:51PM -0800, AJ wrote:
[..snip..]
> 
> I see that python has no problem running multiple threads as long as
> the threads aren't running python code.  So this is fine- only the UI
> code would be in python.  But, I don't really see how to control a
> C/C++ function that is running in a thread from python.  For example,
> we might want to pause one thread of the simulation, examine its
> intermediate results, and then continue the simulation.
> 
[..snip..]
> 
> Can you "pause" a thread?  

I believe the answer to that is "yes, sometimes, on some platforms".
Probably the only sane way to do that is to make your C++ thread
periodically stop calculating and check for a pause message.  

> Is any of this even worth trying to do?  

Probably, but Python takes a very portable approach to threading -- i.e. it
doesn't attempt to support exciting things like pausing or killing threads
from other threads.  Perhaps one of the many thread abstraction libraries
out there does support all the features and platforms that you want, but I
don't know much about them.

Hope this helps,

-Andrew.






More information about the Python-list mailing list