summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-10-11 02:40:51 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-10-11 02:40:51 (GMT)
commit7f468f29f49786988e4f1a005174578fc83c7eb9 (patch)
tree0a675ca5df1a5df96404213998dc51672394328e /Python
parent89c0ec9beba4e6b086e74345bc1ef15041bd5e7d (diff)
downloadcpython-7f468f29f49786988e4f1a005174578fc83c7eb9.zip
cpython-7f468f29f49786988e4f1a005174578fc83c7eb9.tar.gz
cpython-7f468f29f49786988e4f1a005174578fc83c7eb9.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c9
-rw-r--r--Python/pythonrun.c1
2 files changed, 6 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 2223aba..4d26a7a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -203,17 +203,20 @@ PyEval_GetCallStats(PyObject *self)
#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();
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 06bec1e..92e051b 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1517,7 +1517,6 @@ Py_FatalError(const char *msg)
#ifdef WITH_THREAD
#include "pythread.h"
-int _PyThread_Started = 0; /* Set by threadmodule.c and maybe others */
#endif
#define NEXITFUNCS 32