Embedded python: how to force a break to endless looping Python script? (2)

Warren Postma embed at NOSPAM.geocities.com
Tue Aug 22 14:37:43 EDT 2000


Okay, that wasn't clear at all. Here's another go at it:

1. I am embedding a multithreading Python engine.  I use each thread to run
separate scripts, which might include loops, or other things that either run
forever, or take way too much time to complete, which I'd like to kill
remotely.

2. From my reading about the Signals module, it only delivers signals to the
main thread.

3. I have, in a supervisory C thread, access to a linked list of thread
state objects. I'd like to do something like this:


        int CancelExecution( PyThreadState *pyThreadState )
        {
              pyThreadState->RaiseKeyboardInterrupt = 1; // stop code, raise
exception KeyboardInterrupt.
        };

    I
Has anyone done anything like this?

Warren Postma
ZTR Control Systems





More information about the Python-list mailing list