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
9faf4c57
Kaydet (Commit)
9faf4c57
authored
Eki 07, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change title to {Python/C API Reference Manual}; remove \bcode \ecode
which appears to be out of fashion in this file.
üst
46a0bb4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
api.tex
Doc/api.tex
+11
-11
api.tex
Doc/api/api.tex
+11
-11
No files found.
Doc/api.tex
Dosyayı görüntüle @
9faf4c57
\documentstyle
[twoside,11pt,myformat]
{
report
}
\title
{
Python/C API Reference
}
\title
{
Python/C API Reference
Manual
}
\input
{
boilerplate
}
...
...
@@ -1058,13 +1058,13 @@ already imported.)
This is the structure type definition for frozen module descriptors,
as generated by the
\code
{
freeze
}
utility (see
\file
{
Tools/freeze/
}
in
the Python source distribution). Its definition is:
\b
code
\b
egin{verbatim}
\begin{verbatim}
struct
_
frozen
{
char *name;
unsigned char *code;
int size;
}
;
\end{verbatim}
\ecode
\end{verbatim}
\end{ctypedesc}
\begin{cvardesc}
{
struct
_
frozen *
}{
PyImport
_
FrozenModules
}
...
...
@@ -2047,21 +2047,21 @@ the current thread state must be manipulated explicitly.
This is easy enough in most cases. Most code manipulating the global
interpreter lock has the following simple structure:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Save the thread state in a local variable.
Release the interpreter lock.
...Do some blocking I/O operation...
Reacquire the interpreter lock.
Restore the thread state from the local variable.
\end{verbatim}
\ecode
\end{verbatim}
This is so common that a pair of macros exists to simplify it:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Py
_
BEGIN
_
ALLOW
_
THREADS
...Do some blocking I/O operation...
Py
_
END
_
ALLOW
_
THREADS
\end{verbatim}
\ecode
\end{verbatim}
The BEGIN macro opens a new block and declares a hidden local
variable; the END macro closes the block. Another advantage of using
...
...
@@ -2072,19 +2072,19 @@ manipulations.
When thread support is enabled, the block above expands to the
following code:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
PyThreadState *
_
save;
_
save = PyEval
_
SaveThread();
...Do some blocking I/O operation...
PyEval
_
RestoreThread(
_
save);
}
\end{verbatim}
\ecode
\end{verbatim}
Using even lower level primitives, we can get roughly the same effect
as follows:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
PyThreadState *
_
save;
_
save = PyThreadState
_
Swap(NULL);
...
...
@@ -2093,7 +2093,7 @@ as follows:
PyEval
_
AcquireLock();
PyThreadState
_
Swap(
_
save);
}
\end{verbatim}
\ecode
\end{verbatim}
There are some subtle differences; in particular,
\code
{
PyEval
_
RestoreThread()
}
saves and restores the value of the
...
...
Doc/api/api.tex
Dosyayı görüntüle @
9faf4c57
\documentstyle
[twoside,11pt,myformat]
{
report
}
\title
{
Python/C API Reference
}
\title
{
Python/C API Reference
Manual
}
\input
{
boilerplate
}
...
...
@@ -1058,13 +1058,13 @@ already imported.)
This is the structure type definition for frozen module descriptors,
as generated by the
\code
{
freeze
}
utility (see
\file
{
Tools/freeze/
}
in
the Python source distribution). Its definition is:
\b
code
\b
egin{verbatim}
\begin{verbatim}
struct
_
frozen
{
char *name;
unsigned char *code;
int size;
}
;
\end{verbatim}
\ecode
\end{verbatim}
\end{ctypedesc}
\begin{cvardesc}
{
struct
_
frozen *
}{
PyImport
_
FrozenModules
}
...
...
@@ -2047,21 +2047,21 @@ the current thread state must be manipulated explicitly.
This is easy enough in most cases. Most code manipulating the global
interpreter lock has the following simple structure:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Save the thread state in a local variable.
Release the interpreter lock.
...Do some blocking I/O operation...
Reacquire the interpreter lock.
Restore the thread state from the local variable.
\end{verbatim}
\ecode
\end{verbatim}
This is so common that a pair of macros exists to simplify it:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Py
_
BEGIN
_
ALLOW
_
THREADS
...Do some blocking I/O operation...
Py
_
END
_
ALLOW
_
THREADS
\end{verbatim}
\ecode
\end{verbatim}
The BEGIN macro opens a new block and declares a hidden local
variable; the END macro closes the block. Another advantage of using
...
...
@@ -2072,19 +2072,19 @@ manipulations.
When thread support is enabled, the block above expands to the
following code:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
PyThreadState *
_
save;
_
save = PyEval
_
SaveThread();
...Do some blocking I/O operation...
PyEval
_
RestoreThread(
_
save);
}
\end{verbatim}
\ecode
\end{verbatim}
Using even lower level primitives, we can get roughly the same effect
as follows:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
PyThreadState *
_
save;
_
save = PyThreadState
_
Swap(NULL);
...
...
@@ -2093,7 +2093,7 @@ as follows:
PyEval
_
AcquireLock();
PyThreadState
_
Swap(
_
save);
}
\end{verbatim}
\ecode
\end{verbatim}
There are some subtle differences; in particular,
\code
{
PyEval
_
RestoreThread()
}
saves and restores the value of the
...
...
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