[Python-checkins] python/dist/src/Modules threadmodule.c,2.54,2.55
kbk@users.sourceforge.net
kbk@users.sourceforge.net
Fri, 13 Jun 2003 14:59:47 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv31620
Modified Files:
threadmodule.c
Log Message:
Add interrupt_main() to thread module.
Index: threadmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v
retrieving revision 2.54
retrieving revision 2.55
diff -C2 -d -r2.54 -r2.55
*** threadmodule.c 29 Apr 2003 19:44:05 -0000 2.54
--- threadmodule.c 13 Jun 2003 21:59:45 -0000 2.55
***************
*** 279,282 ****
--- 279,297 ----
thread to exit silently unless the exception is caught.");
+ static PyObject *
+ sys_interrupt_main(PyObject * self, PyObject * args)
+ {
+ PyErr_SetInterrupt();
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ PyDoc_STRVAR(interrupt_doc,
+ "interrupt_main()\n\
+ \n\
+ Raise a KeyboardInterrupt in the main thread.\n\
+ A subthread can use this method to interrupt the main thread."
+ );
+
#ifndef NO_EXIT_PROG
static PyObject *
***************
*** 341,344 ****
--- 356,361 ----
{"exit", (PyCFunction)thread_PyThread_exit_thread,
METH_NOARGS, exit_doc},
+ {"interrupt_main", (PyCFunction)sys_interrupt_main,
+ METH_NOARGS, interrupt_doc},
{"get_ident", (PyCFunction)thread_get_ident,
METH_NOARGS, get_ident_doc},