embedding: forcing an interpreter to end
pdectm at yahoo.com
pdectm at yahoo.com
Tue Dec 21 22:03:46 EST 2004
> Is there any signal handler you can use in your C program? Maybe
signling
> yourself will get the control back to the C program and then you can
kill
> the interpreter.
Well, the app is multi-threaded, so I do have a big issue getting
control back to my C program. I just can not seem to cleanly stop the
interpreter. The best I could do is:
void terminateInterpreter( PyInterpreterState *interp )
{
PyGILState_STATE gilstate;
PyObject *exc;
PyThreadState *tstate;
gilstate = PyGILState_Ensure();
tstate = PyThreadState_Swap(interp->tstate);
exc = PyString_FromString("Die");
PyThreadState_SetAsyncExc(interp->tstate->thread_id, exc);
Py_DECREF(exc);
PyThreadState_Swap(tstate);
PyGILState_Release(gilstate);
}
> You have a Python port to uClinux?
Nope, not yet. That would have been my next post :-) I thought there
would have been much more work on cross-compiling and porting Python.
I may need to reconsider if Python is appropriate; the other
possibiities are javascript or lua.
More information about the Python-list
mailing list