Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 33715:a46b76eb9053 legacy-trunk
SF patch 1044089: New C API function PyEval_ThreadsInitialized(), by Nick
Coghlan, for determining whether PyEval_InitThreads() has been called.
Also purged the undocumented+unused _PyThread_Started int.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Mon, 11 Oct 2004 02:40:51 +0000 |
| parents | af9bedd5a8e7 |
| children | be370abb020f |
line wrap: on
line diff
--- a/Python/ceval.c Sun Oct 10 05:30:40 2004 +0000 +++ b/Python/ceval.c Mon Oct 11 02:40:51 2004 +0000 @@ -203,17 +203,20 @@ #endif #include "pythread.h" -extern int _PyThread_Started; /* Flag for Py_Exit */ - static PyThread_type_lock interpreter_lock = 0; /* This is the GIL */ static long main_thread = 0; +int +PyEval_ThreadsInitialized(void) +{ + return interpreter_lock != 0; +} + void PyEval_InitThreads(void) { if (interpreter_lock) return; - _PyThread_Started = 1; interpreter_lock = PyThread_allocate_lock(); PyThread_acquire_lock(interpreter_lock, 1); main_thread = PyThread_get_thread_ident();
