@@ -24,7 +24,7 @@ \chapter{Initialization, Finalization, and Threads
2424\end {cfuncdesc }
2525
2626\begin {cfuncdesc }{void}{Py_InitializeEx}{int initsigs}
27- This function works like \cfunction {Py_Initialize} if
27+ This function works like \cfunction {Py_Initialize() } if
2828 \var {initsigs} is 1. If \var {initsigs} is 0, it skips
2929 initialization registration of signal handlers, which
3030 might be useful when Python is embedded. \versionadded {2.4}
@@ -517,14 +517,14 @@ \section{Thread State and the Global Interpreter Lock
517517 This is a common situation (most Python programs do not use
518518 threads), and the lock operations slow the interpreter down a bit.
519519 Therefore, the lock is not created initially. This situation is
520- equivalent to having acquired the lock: when there is only a single
520+ equivalent to having acquired the lock: when there is only a single
521521 thread, all object accesses are safe. Therefore, when this function
522522 initializes the lock, it also acquires it. Before the Python
523523 \module {thread}\refbimodindex {thread} module creates a new thread,
524524 knowing that either it has the lock or the lock hasn't been created
525525 yet, it calls \cfunction {PyEval_InitThreads()}. When this call
526- returns, it is guaranteed that the lock has been created and that it
527- has acquired it.
526+ returns, it is guaranteed that the lock has been created and that the
527+ calling thread has acquired it.
528528
529529 It is \strong {not} safe to call this function when it is unknown
530530 which thread (if any) currently has the global interpreter lock.
@@ -533,6 +533,14 @@ \section{Thread State and the Global Interpreter Lock
533533 compile time.
534534\end {cfuncdesc }
535535
536+ \begin {cfuncdesc }{int}{PyEval_ThreadsInitialized}{}
537+ Returns a non-zero value if \cfunction {PyEval_InitThreads()} has been
538+ called. This function can be called without holding the lock, and
539+ therefore can be used to avoid calls to the locking API when running
540+ single-threaded. This function is not available when thread support
541+ is disabled at compile time. \versionadded {2.4}
542+ \end {cfuncdesc }
543+
536544\begin {cfuncdesc }{void}{PyEval_AcquireLock}{}
537545 Acquire the global interpreter lock. The lock must have been
538546 created earlier. If this thread already has the lock, a deadlock
0 commit comments