diff options
author | Guido van Rossum <guido@python.org> | 1997-07-18 23:56:58 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-07-18 23:56:58 (GMT) |
commit | 2fca21f76280300201acf529527e58e2705ff6aa (patch) | |
tree | 58956bb1a49d02d54dbc226523c0a771cb48e05e /Include/ceval.h | |
parent | c864ad695f9831340d10b1b4161524a58780422f (diff) | |
download | cpython-2fca21f76280300201acf529527e58e2705ff6aa.zip cpython-2fca21f76280300201acf529527e58e2705ff6aa.tar.gz cpython-2fca21f76280300201acf529527e58e2705ff6aa.tar.bz2 |
PyEval_SaveThread() and PyEval_RestoreThread() now return/take a
PyThreadState pointer instead of a (frame) PyObject pointer. This
makes much more sense. It is backward incompatible, but that's no
problem, because (a) the heaviest users are the Py_{BEGIN,END}_
ALLOW_THREADS macros here, which have been fixed too; (b) there are
very few direct users; (c) those who use it are there will probably
appreciate the change.
Also, added new functions PyEval_AcquireThread() and
PyEval_ReleaseThread() which allows the threads created by the thread
module as well threads created by others (!) to set/reset the current
thread, and at the same time acquire/release the interpreter lock.
Much saner.
Diffstat (limited to 'Include/ceval.h')
-rw-r--r-- | Include/ceval.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Include/ceval.h b/Include/ceval.h index 68c5977..2336ed3 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -100,13 +100,16 @@ int Py_MakePendingCalls Py_PROTO((void)); */ extern void PyEval_InitThreads Py_PROTO((void)); -extern PyObject *PyEval_SaveThread Py_PROTO((void)); -extern void PyEval_RestoreThread Py_PROTO((PyObject *)); +extern PyThreadState *PyEval_SaveThread Py_PROTO((void)); +extern void PyEval_RestoreThread Py_PROTO((PyThreadState *)); #ifdef WITH_THREAD +extern void PyEval_AcquireThread Py_PROTO((PyThreadState *tstate)); +extern void PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate)); + #define Py_BEGIN_ALLOW_THREADS { \ - PyObject *_save; \ + PyThreadState *_save; \ _save = PyEval_SaveThread(); #define Py_BLOCK_THREADS PyEval_RestoreThread(_save); #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); |