diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2003-04-19 15:41:53 (GMT) |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2003-04-19 15:41:53 (GMT) |
commit | 8d98d2cb95ac37147a4de5a119869211e8351324 (patch) | |
tree | 8175d77139194bffa61b79d19544525927a13fc5 /Python/pythonrun.c | |
parent | e36b6900878b8715c37bfa241381dddb82cda386 (diff) | |
download | cpython-8d98d2cb95ac37147a4de5a119869211e8351324.zip cpython-8d98d2cb95ac37147a4de5a119869211e8351324.tar.gz cpython-8d98d2cb95ac37147a4de5a119869211e8351324.tar.bz2 |
New PyGILState_ API - implements pep 311, from patch 684256.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 0a9a637..29ba120 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -50,6 +50,11 @@ static void call_ll_exitfuncs(void); extern void _PyUnicode_Init(void); extern void _PyUnicode_Fini(void); +#ifdef WITH_THREAD +extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); +extern void _PyGILState_Fini(void); +#endif /* WITH_THREAD */ + int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ @@ -180,6 +185,11 @@ Py_Initialize(void) if (!Py_NoSiteFlag) initsite(); /* Module site */ + /* auto-thread-state API, if available */ +#ifdef WITH_THREAD + _PyGILState_Init(interp, tstate); +#endif /* WITH_THREAD */ + PyModule_WarningsModule = PyImport_ImportModule("warnings"); #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) @@ -244,6 +254,11 @@ Py_Finalize(void) call_sys_exitfunc(); initialized = 0; + /* Cleanup auto-thread-state */ +#ifdef WITH_THREAD + _PyGILState_Fini(); +#endif /* WITH_THREAD */ + /* Get current thread state and interpreter pointer */ tstate = PyThreadState_Get(); interp = tstate->interp; |