diff options
author | Fred Drake <fdrake@acm.org> | 2002-04-09 21:09:42 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-04-09 21:09:42 (GMT) |
commit | 375e30225eeec765d00dfab600f4e7333d8a86d5 (patch) | |
tree | b4cb99ec029e78ecfe5ea58fe1e5c1d36db006c1 | |
parent | 79bf99c5051451b8af900cb26b6080c56690d4a2 (diff) | |
download | cpython-375e30225eeec765d00dfab600f4e7333d8a86d5.zip cpython-375e30225eeec765d00dfab600f4e7333d8a86d5.tar.gz cpython-375e30225eeec765d00dfab600f4e7333d8a86d5.tar.bz2 |
Update to use the new \csimplemacro macro
-rw-r--r-- | Doc/api/init.tex | 36 | ||||
-rw-r--r-- | Doc/ext/extending.tex | 10 |
2 files changed, 24 insertions, 22 deletions
diff --git a/Doc/api/init.tex b/Doc/api/init.tex index 5066c5c..712ca54 100644 --- a/Doc/api/init.tex +++ b/Doc/api/init.tex @@ -391,12 +391,13 @@ Py_BEGIN_ALLOW_THREADS Py_END_ALLOW_THREADS \end{verbatim} -The \code{Py_BEGIN_ALLOW_THREADS}\ttindex{Py_BEGIN_ALLOW_THREADS} macro -opens a new block and declares a hidden local variable; the -\code{Py_END_ALLOW_THREADS}\ttindex{Py_END_ALLOW_THREADS} macro closes -the block. Another advantage of using these two macros is that when -Python is compiled without thread support, they are defined empty, -thus saving the thread state and lock manipulations. +The +\csimplemacro{Py_BEGIN_ALLOW_THREADS}\ttindex{Py_BEGIN_ALLOW_THREADS} +macro opens a new block and declares a hidden local variable; the +\csimplemacro{Py_END_ALLOW_THREADS}\ttindex{Py_END_ALLOW_THREADS} +macro closes the block. Another advantage of using these two macros +is that when Python is compiled without thread support, they are +defined empty, thus saving the thread state and lock manipulations. When thread support is enabled, the block above expands to the following code: @@ -574,30 +575,31 @@ look for example usage in the Python source distribution. This macro expands to \samp{\{ PyThreadState *_save; _save = PyEval_SaveThread();}. Note that it contains an opening brace; it must be matched with a - following \code{Py_END_ALLOW_THREADS} macro. See above for further - discussion of this macro. It is a no-op when thread support is - disabled at compile time. + following \csimplemacro{Py_END_ALLOW_THREADS} macro. See above for + further discussion of this macro. It is a no-op when thread support + is disabled at compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_END_ALLOW_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save); \}}. Note that it contains a closing brace; it must be matched with an - earlier \code{Py_BEGIN_ALLOW_THREADS} macro. See above for further - discussion of this macro. It is a no-op when thread support is - disabled at compile time. + earlier \csimplemacro{Py_BEGIN_ALLOW_THREADS} macro. See above for + further discussion of this macro. It is a no-op when thread support + is disabled at compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_BLOCK_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save);}: it is - equivalent to \code{Py_END_ALLOW_THREADS} without the closing brace. - It is a no-op when thread support is disabled at compile time. + equivalent to \csimplemacro{Py_END_ALLOW_THREADS} without the + closing brace. It is a no-op when thread support is disabled at + compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_UNBLOCK_THREADS} This macro expands to \samp{_save = PyEval_SaveThread();}: it is - equivalent to \code{Py_BEGIN_ALLOW_THREADS} without the opening - brace and variable declaration. It is a no-op when thread support - is disabled at compile time. + equivalent to \csimplemacro{Py_BEGIN_ALLOW_THREADS} without the + opening brace and variable declaration. It is a no-op when thread + support is disabled at compile time. \end{csimplemacrodesc} All of the following functions are only available when thread support diff --git a/Doc/ext/extending.tex b/Doc/ext/extending.tex index 7eafc05..90385e1 100644 --- a/Doc/ext/extending.tex +++ b/Doc/ext/extending.tex @@ -1068,11 +1068,11 @@ involving threads. Normally, multiple threads in the Python interpreter can't get in each other's way, because there is a global lock protecting Python's entire object space. However, it is possible to temporarily release this lock using the macro -\code{Py_BEGIN_ALLOW_THREADS}, and to re-acquire it using -\code{Py_END_ALLOW_THREADS}. This is common around blocking I/O -calls, to let other threads use the processor while waiting for the I/O to -complete. Obviously, the following function has the same problem as -the previous one: +\csimplemacro{Py_BEGIN_ALLOW_THREADS}, and to re-acquire it using +\csimplemacro{Py_END_ALLOW_THREADS}. This is common around blocking +I/O calls, to let other threads use the processor while waiting for +the I/O to complete. Obviously, the following function has the same +problem as the previous one: \begin{verbatim} bug(PyObject *list) { |