diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2003-04-19 15:41:53 +0000 |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2003-04-19 15:41:53 +0000 |
commit | b76a0eb8a173e99ebdb3d8b6765724e62197f3fe (patch) | |
tree | a942d7c98549127ea51ab6a92fefae3f677713c4 /Python/pythonrun.c | |
parent | dbb34336d411b831e8960e85a416ce91c4fc0009 (diff) | |
download | cpython-b76a0eb8a173e99ebdb3d8b6765724e62197f3fe.tar.gz |
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 0a9a63723c..29ba120c2b 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; |