]> granicus.if.org Git - python/commitdiff
Use the new functions PyEval_AcquireThread() and
authorGuido van Rossum <guido@python.org>
Fri, 18 Jul 1997 23:57:50 +0000 (23:57 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 18 Jul 1997 23:57:50 +0000 (23:57 +0000)
PyEval_ReleaseThread() (in ceval.c) to set/reset the current thread,
and at the same time acquire/release the interpreter lock.

Much saner.

Modules/threadmodule.c

index 99ca4afc911882ace387f62e35b55ccc1abb56b2..22017992a546be802a4bde347456dd17dc7abf65 100644 (file)
@@ -203,12 +203,11 @@ t_bootstrap(boot_raw)
        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 @@ t_bootstrap(boot_raw)
        }
        else
                Py_DECREF(res);
-       (void) PyThreadState_Swap(alttstate);
-       (void) PyEval_SaveThread();
+       PyEval_ReleaseThread(tstate);
        PyThreadState_Delete(tstate);
        exit_thread();
 }