@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3030
3131/* Interface to random parts in ceval.c */
3232
33- object * call_object PROTO (( object * , object * ) );
33+ PyObject * PyEval_CallObject Py_PROTO (( PyObject * , PyObject * ) );
3434
35- object * getbuiltins PROTO ((void ));
36- object * getglobals PROTO ((void ));
37- object * getlocals PROTO ((void ));
38- object * getowner PROTO ((void ));
39- object * getframe PROTO ((void ));
40- int getrestricted PROTO ((void ));
35+ PyObject * PyEval_GetBuiltins Py_PROTO ((void ));
36+ PyObject * PyEval_GetGlobals Py_PROTO ((void ));
37+ PyObject * PyEval_GetLocals Py_PROTO ((void ));
38+ PyObject * PyEval_GetOwner Py_PROTO ((void ));
39+ PyObject * PyEval_GetFrame Py_PROTO ((void ));
40+ int PyEval_GetRestricted Py_PROTO ((void ));
4141
42- void flushline PROTO ((void ));
42+ void Py_FlushLine Py_PROTO ((void ));
4343
44- int Py_AddPendingCall PROTO ((int (* func ) PROTO ((ANY * )), ANY * arg ));
45- int Py_MakePendingCalls PROTO ((void ));
44+ int Py_AddPendingCall Py_PROTO ((int (* func ) Py_PROTO ((ANY * )), ANY * arg ));
45+ int Py_MakePendingCalls Py_PROTO ((void ));
4646
4747
4848/* Interface for threads.
@@ -52,62 +52,64 @@ int Py_MakePendingCalls PROTO((void));
5252 threads to run as follows:
5353
5454 ...preparations here...
55- BGN_SAVE
55+ Py_BEGIN_ALLOW_THREADS
5656 ...blocking system call here...
57- END_SAVE
57+ Py_END_ALLOW_THREADS
5858 ...interpret result here...
5959
60- The BGN_SAVE/END_SAVE pair expands to a {}-surrounded block.
60+ The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
61+ {}-surrounded block.
6162 To leave the block in the middle (e.g., with return), you must insert
6263 a line containing RET_SAVE before the return, e.g.
6364
6465 if (...premature_exit...) {
65- RET_SAVE
66- err_errno(IOError );
66+ Py_BLOCK_THREADS
67+ PyErr_SetFromErrno(PyExc_IOError );
6768 return NULL;
6869 }
6970
7071 An alternative is:
7172
72- RET_SAVE
73+ Py_BLOCK_THREADS
7374 if (...premature_exit...) {
74- err_errno(IOError );
75+ PyErr_SetFromErrno(PyExc_IOError );
7576 return NULL;
7677 }
77- RES_SAVE
78+ Py_UNBLOCK_THREADS
7879
7980 For convenience, that the value of 'errno' is restored across
80- END_SAVE and RET_SAVE.
81+ Py_END_ALLOW_THREADS and RET_SAVE.
8182
82- WARNING: NEVER NEST CALLS TO BGN_SAVE AND END_SAVE!!!
83+ WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
84+ Py_END_ALLOW_THREADS!!!
8385
84- The function init_save_thread () should be called only from
86+ The function PyEval_InitThreads () should be called only from
8587 initthread() in "threadmodule.c".
8688
8789 Note that not yet all candidates have been converted to use this
8890 mechanism!
8991*/
9092
91- extern void init_save_thread PROTO ((void ));
92- extern object * save_thread PROTO ((void ));
93- extern void restore_thread PROTO (( object * ) );
93+ extern void PyEval_InitThreads Py_PROTO ((void ));
94+ extern PyObject * PyEval_SaveThread Py_PROTO ((void ));
95+ extern void PyEval_RestoreThread Py_PROTO (( PyObject * ) );
9496
9597#ifdef WITH_THREAD
9698
97- #define BGN_SAVE { \
98- object *_save; \
99- _save = save_thread ();
100- #define RET_SAVE restore_thread (_save);
101- #define RES_SAVE _save = save_thread ();
102- #define END_SAVE restore_thread (_save); \
99+ #define Py_BEGIN_ALLOW_THREADS { \
100+ PyObject *_save; \
101+ _save = PyEval_SaveThread ();
102+ #define Py_BLOCK_THREADS PyEval_RestoreThread (_save);
103+ #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread ();
104+ #define Py_END_ALLOW_THREADS PyEval_RestoreThread (_save); \
103105 }
104106
105107#else /* !WITH_THREAD */
106108
107- #define BGN_SAVE {
108- #define RET_SAVE
109- #define RES_SAVE
110- #define END_SAVE }
109+ #define Py_BEGIN_ALLOW_THREADS {
110+ #define Py_BLOCK_THREADS
111+ #define Py_UNBLOCK_THREADS
112+ #define Py_END_ALLOW_THREADS }
111113
112114#endif /* !WITH_THREAD */
113115
0 commit comments