[Python-checkins] CVS: python/dist/src/Modules threadmodule.c,2.42,2.43

Guido van Rossum gvanrossum@users.sourceforge.net
2001年10月16日 14:13:51 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv29764/Modules
Modified Files:
	threadmodule.c 
Log Message:
Partial patch from SF #452266, by Jason Petrone.
This changes Pythread_start_thread() to return the thread ID, or -1
for an error. (It's technically an incompatible API change, but I
doubt anyone calls it.)
Index: threadmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v
retrieving revision 2.42
retrieving revision 2.43
diff -C2 -d -r2.42 -r2.43
*** threadmodule.c	2001年10月05日 12:24:15	2.42
--- threadmodule.c	2001年10月16日 21:13:49	2.43
***************
*** 214,217 ****
--- 214,218 ----
 	PyObject *func, *args, *keyw = NULL;
 	struct bootstate *boot;
+ 	long ident;
 
 	if (!PyArg_ParseTuple(fargs, "OO|O:start_new_thread", &func, &args, &keyw))
***************
*** 243,247 ****
 	Py_XINCREF(keyw);
 	PyEval_InitThreads(); /* Start the interpreter's thread-awareness */
! 	if (!PyThread_start_new_thread(t_bootstrap, (void*) boot)) {
 		PyErr_SetString(ThreadError, "can't start new thread\n");
 		Py_DECREF(func);
--- 244,249 ----
 	Py_XINCREF(keyw);
 	PyEval_InitThreads(); /* Start the interpreter's thread-awareness */
! 	ident = PyThread_start_new_thread(t_bootstrap, (void*) boot);
! 	if (ident == -1) {
 		PyErr_SetString(ThreadError, "can't start new thread\n");
 		Py_DECREF(func);
***************
*** 251,256 ****
 		return NULL;
 	}
! 	Py_INCREF(Py_None);
! 	return Py_None;
 }
 
--- 253,257 ----
 		return NULL;
 	}
! 	return PyInt_FromLong(ident);
 }
 
***************
*** 259,268 ****
 (start_new() is an obsolete synonym)\n\
 \n\
! Start a new thread. The thread will call the function with positional\n\
! arguments from the tuple args and keyword arguments taken from the optional\n\
! dictionary kwargs. The thread exits when the function returns; the return\n\
! value is ignored. The thread will also exit when the function raises an\n\
! unhandled exception; a stack trace will be printed unless the exception is\n\
! SystemExit.";
 
 static PyObject *
--- 260,269 ----
 (start_new() is an obsolete synonym)\n\
 \n\
! Start a new thread and return its identifier. The thread will call the\n\
! function with positional arguments from the tuple args and keyword arguments\n\
! taken from the optional dictionary kwargs. The thread exits when the\n\
! function returns; the return value is ignored. The thread will also exit\n\
! when the function raises an unhandled exception; a stack trace will be\n\
! printed unless the exception is SystemExit.\n";
 
 static PyObject *

AltStyle によって変換されたページ (->オリジナル) /