Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 28694:a4154dd5939a legacy-trunk
New PyGILState_ API - implements pep 311, from patch 684256.
| author | Mark Hammond <mhammond@skippinet.com.au> |
|---|---|
| date | Sat, 19 Apr 2003 15:41:53 +0000 |
| parents | 56006d97bcef |
| children | aef01a076ef9 |
line wrap: on
line diff
--- a/Python/pythonrun.c Sat Apr 19 15:38:47 2003 +0000 +++ b/Python/pythonrun.c Sat Apr 19 15:41:53 2003 +0000 @@ -50,6 +50,11 @@ 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 @@ 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 @@ 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;
