embedded python - cancel "while 1: pass"

Fredrik Lundh fredrik at effbot.org
Wed Jan 3 13:40:36 EST 2001


Warren wrote:
> So what do I do?   I've got Python 1.5.2 embedded into a large C
> application, and it runs user-defined scripts.  When a user defined script
> goes south, the only way to fix it is to reboot our embedded system. I'd
> actually like to do something like
>
>  PyThreadState *tstate;
>
>     tstate = PyThreadState_Get();
>     PyThread_Signal( tstate, ABORT);

something like this might work:

static int
getoutofhere(void *unused)
{
    PyErr_SetNone(PyExc_KeyboardInterrupt);
    return -1;
}

Py_AddPendingCall(getoutofhere, NULL);

cheers /F





More information about the Python-list mailing list