Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
375e3022
Kaydet (Commit)
375e3022
authored
Nis 09, 2002
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update to use the new \csimplemacro macro
üst
79bf99c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
init.tex
Doc/api/init.tex
+19
-17
extending.tex
Doc/ext/extending.tex
+5
-5
No files found.
Doc/api/init.tex
Dosyayı görüntüle @
375e3022
...
...
@@ -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
\c
ode
{
Py
_
END
_
ALLOW
_
THREADS
}
macro. See above for furthe
r
discussion of this macro. It is a no-op when thread support is
disabled at compile time.
following
\c
simplemacro
{
Py
_
END
_
ALLOW
_
THREADS
}
macro. See above fo
r
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
\c
ode
{
Py
_
BEGIN
_
ALLOW
_
THREADS
}
macro. See above for furthe
r
discussion of this macro. It is a no-op when thread support is
disabled at compile time.
earlier
\c
simplemacro
{
Py
_
BEGIN
_
ALLOW
_
THREADS
}
macro. See above fo
r
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
\c
ode
{
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
\c
simplemacro
{
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
...
...
Doc/ext/extending.tex
Dosyayı görüntüle @
375e3022
...
...
@@ -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
\c
ode
{
Py
_
BEGIN
_
ALLOW
_
THREADS
}
, and to re-acquire it using
\c
ode
{
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:
\c
simplemacro
{
Py
_
BEGIN
_
ALLOW
_
THREADS
}
, and to re-acquire it using
\c
simplemacro
{
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)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment