Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 375e302

Browse files
committed
Update to use the new \csimplemacro macro
1 parent 79bf99c commit 375e302

2 files changed

Lines changed: 24 additions & 22 deletions

File tree

Doc/api/init.tex

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,13 @@ \section{Thread State and the Global Interpreter Lock
391391
Py_END_ALLOW_THREADS
392392
\end{verbatim}
393393

394-
The \code{Py_BEGIN_ALLOW_THREADS}\ttindex{Py_BEGIN_ALLOW_THREADS} macro
395-
opens a new block and declares a hidden local variable; the
396-
\code{Py_END_ALLOW_THREADS}\ttindex{Py_END_ALLOW_THREADS} macro closes
397-
the block. Another advantage of using these two macros is that when
398-
Python is compiled without thread support, they are defined empty,
399-
thus saving the thread state and lock manipulations.
394+
The
395+
\csimplemacro{Py_BEGIN_ALLOW_THREADS}\ttindex{Py_BEGIN_ALLOW_THREADS}
396+
macro opens a new block and declares a hidden local variable; the
397+
\csimplemacro{Py_END_ALLOW_THREADS}\ttindex{Py_END_ALLOW_THREADS}
398+
macro closes the block. Another advantage of using these two macros
399+
is that when Python is compiled without thread support, they are
400+
defined empty, thus saving the thread state and lock manipulations.
400401

401402
When thread support is enabled, the block above expands to the
402403
following code:
@@ -574,30 +575,31 @@ \section{Thread State and the Global Interpreter Lock
574575
This macro expands to
575576
\samp{\{ PyThreadState *_save; _save = PyEval_SaveThread();}.
576577
Note that it contains an opening brace; it must be matched with a
577-
following \code{Py_END_ALLOW_THREADS} macro. See above for further
578-
discussion of this macro. It is a no-op when thread support is
579-
disabled at compile time.
578+
following \csimplemacro{Py_END_ALLOW_THREADS} macro. See above for
579+
further discussion of this macro. It is a no-op when thread support
580+
is disabled at compile time.
580581
\end{csimplemacrodesc}
581582

582583
\begin{csimplemacrodesc}{Py_END_ALLOW_THREADS}
583584
This macro expands to \samp{PyEval_RestoreThread(_save); \}}.
584585
Note that it contains a closing brace; it must be matched with an
585-
earlier \code{Py_BEGIN_ALLOW_THREADS} macro. See above for further
586-
discussion of this macro. It is a no-op when thread support is
587-
disabled at compile time.
586+
earlier \csimplemacro{Py_BEGIN_ALLOW_THREADS} macro. See above for
587+
further discussion of this macro. It is a no-op when thread support
588+
is disabled at compile time.
588589
\end{csimplemacrodesc}
589590

590591
\begin{csimplemacrodesc}{Py_BLOCK_THREADS}
591592
This macro expands to \samp{PyEval_RestoreThread(_save);}: it is
592-
equivalent to \code{Py_END_ALLOW_THREADS} without the closing brace.
593-
It is a no-op when thread support is disabled at compile time.
593+
equivalent to \csimplemacro{Py_END_ALLOW_THREADS} without the
594+
closing brace. It is a no-op when thread support is disabled at
595+
compile time.
594596
\end{csimplemacrodesc}
595597

596598
\begin{csimplemacrodesc}{Py_UNBLOCK_THREADS}
597599
This macro expands to \samp{_save = PyEval_SaveThread();}: it is
598-
equivalent to \code{Py_BEGIN_ALLOW_THREADS} without the opening
599-
brace and variable declaration. It is a no-op when thread support
600-
is disabled at compile time.
600+
equivalent to \csimplemacro{Py_BEGIN_ALLOW_THREADS} without the
601+
opening brace and variable declaration. It is a no-op when thread
602+
support is disabled at compile time.
601603
\end{csimplemacrodesc}
602604

603605
All of the following functions are only available when thread support

Doc/ext/extending.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,11 +1068,11 @@ \subsection{Thin Ice
10681068
interpreter can't get in each other's way, because there is a global
10691069
lock protecting Python's entire object space. However, it is possible
10701070
to temporarily release this lock using the macro
1071-
\code{Py_BEGIN_ALLOW_THREADS}, and to re-acquire it using
1072-
\code{Py_END_ALLOW_THREADS}. This is common around blocking I/O
1073-
calls, to let other threads use the processor while waiting for the I/O to
1074-
complete. Obviously, the following function has the same problem as
1075-
the previous one:
1071+
\csimplemacro{Py_BEGIN_ALLOW_THREADS}, and to re-acquire it using
1072+
\csimplemacro{Py_END_ALLOW_THREADS}. This is common around blocking
1073+
I/O calls, to let other threads use the processor while waiting for
1074+
the I/O to complete. Obviously, the following function has the same
1075+
problem as the previous one:
10761076

10771077
\begin{verbatim}
10781078
bug(PyObject *list) {

0 commit comments

Comments
 (0)