diff Modules/threadmodule.c @ 5847:ff9c0110079b legacy-trunk

Use the new functions PyEval_AcquireThread() and PyEval_ReleaseThread() (in ceval.c) to set/reset the current thread, and at the same time acquire/release the interpreter lock. Much saner.
author Guido van Rossum <guido@python.org>
date Fri, 18 Jul 1997 23:57:50 +0000
parents b7871ca930ad
children 63bc9289ab28
line wrap: on
line diff
--- a/Modules/threadmodule.c	Fri Jul 18 23:56:58 1997 +0000
+++ b/Modules/threadmodule.c	Fri Jul 18 23:57:50 1997 +0000
@@ -203,12 +203,11 @@
 	void *boot_raw;
 {
 	struct bootstate *boot = (struct bootstate *) boot_raw;
-	PyThreadState *alttstate, *tstate;
+	PyThreadState *tstate;
 	PyObject *res;
 
 	tstate = PyThreadState_New(boot->interp);
-	PyEval_RestoreThread((void *)NULL);
-	alttstate = PyThreadState_Swap(tstate);
+	PyEval_AcquireThread(tstate);
 	res = PyEval_CallObjectWithKeywords(
 		boot->func, boot->args, boot->keyw);
 	Py_DECREF(boot->func);
@@ -225,8 +224,7 @@
 	}
 	else
 		Py_DECREF(res);
-	(void) PyThreadState_Swap(alttstate);
-	(void) PyEval_SaveThread();
+	PyEval_ReleaseThread(tstate);
 	PyThreadState_Delete(tstate);
 	exit_thread();
 }