Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d00681ce
Commit
d00681ce
authored
Oct 07, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change title to {Python/C API Reference Manual}; remove \bcode \ecode
which appears to be out of fashion in this file.
parent
39cb6963
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
Doc/api.tex
Doc/api.tex
+11
-11
Doc/api/api.tex
Doc/api/api.tex
+11
-11
No files found.
Doc/api.tex
View file @
d00681ce
\documentstyle
[twoside,11pt,myformat]
{
report
}
\documentstyle
[twoside,11pt,myformat]
{
report
}
\title
{
Python/C API Reference
}
\title
{
Python/C API Reference
Manual
}
\input
{
boilerplate
}
\input
{
boilerplate
}
...
@@ -1058,13 +1058,13 @@ already imported.)
...
@@ -1058,13 +1058,13 @@ already imported.)
This is the structure type definition for frozen module descriptors,
This is the structure type definition for frozen module descriptors,
as generated by the
\code
{
freeze
}
utility (see
\file
{
Tools/freeze/
}
in
as generated by the
\code
{
freeze
}
utility (see
\file
{
Tools/freeze/
}
in
the Python source distribution). Its definition is:
the Python source distribution). Its definition is:
\b
code
\b
egin{verbatim}
\begin{verbatim}
struct
_
frozen
{
struct
_
frozen
{
char *name;
char *name;
unsigned char *code;
unsigned char *code;
int size;
int size;
}
;
}
;
\end{verbatim}
\ecode
\end{verbatim}
\end{ctypedesc}
\end{ctypedesc}
\begin{cvardesc}
{
struct
_
frozen *
}{
PyImport
_
FrozenModules
}
\begin{cvardesc}
{
struct
_
frozen *
}{
PyImport
_
FrozenModules
}
...
@@ -2047,21 +2047,21 @@ the current thread state must be manipulated explicitly.
...
@@ -2047,21 +2047,21 @@ the current thread state must be manipulated explicitly.
This is easy enough in most cases. Most code manipulating the global
This is easy enough in most cases. Most code manipulating the global
interpreter lock has the following simple structure:
interpreter lock has the following simple structure:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Save the thread state in a local variable.
Save the thread state in a local variable.
Release the interpreter lock.
Release the interpreter lock.
...Do some blocking I/O operation...
...Do some blocking I/O operation...
Reacquire the interpreter lock.
Reacquire the interpreter lock.
Restore the thread state from the local variable.
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:
This is so common that a pair of macros exists to simplify it:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Py
_
BEGIN
_
ALLOW
_
THREADS
Py
_
BEGIN
_
ALLOW
_
THREADS
...Do some blocking I/O operation...
...Do some blocking I/O operation...
Py
_
END
_
ALLOW
_
THREADS
Py
_
END
_
ALLOW
_
THREADS
\end{verbatim}
\ecode
\end{verbatim}
The BEGIN macro opens a new block and declares a hidden local
The BEGIN macro opens a new block and declares a hidden local
variable; the END macro closes the block. Another advantage of using
variable; the END macro closes the block. Another advantage of using
...
@@ -2072,19 +2072,19 @@ manipulations.
...
@@ -2072,19 +2072,19 @@ manipulations.
When thread support is enabled, the block above expands to the
When thread support is enabled, the block above expands to the
following code:
following code:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
{
PyThreadState *
_
save;
PyThreadState *
_
save;
_
save = PyEval
_
SaveThread();
_
save = PyEval
_
SaveThread();
...Do some blocking I/O operation...
...Do some blocking I/O operation...
PyEval
_
RestoreThread(
_
save);
PyEval
_
RestoreThread(
_
save);
}
}
\end{verbatim}
\ecode
\end{verbatim}
Using even lower level primitives, we can get roughly the same effect
Using even lower level primitives, we can get roughly the same effect
as follows:
as follows:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
{
PyThreadState *
_
save;
PyThreadState *
_
save;
_
save = PyThreadState
_
Swap(NULL);
_
save = PyThreadState
_
Swap(NULL);
...
@@ -2093,7 +2093,7 @@ as follows:
...
@@ -2093,7 +2093,7 @@ as follows:
PyEval
_
AcquireLock();
PyEval
_
AcquireLock();
PyThreadState
_
Swap(
_
save);
PyThreadState
_
Swap(
_
save);
}
}
\end{verbatim}
\ecode
\end{verbatim}
There are some subtle differences; in particular,
There are some subtle differences; in particular,
\code
{
PyEval
_
RestoreThread()
}
saves and restores the value of the
\code
{
PyEval
_
RestoreThread()
}
saves and restores the value of the
...
...
Doc/api/api.tex
View file @
d00681ce
\documentstyle
[twoside,11pt,myformat]
{
report
}
\documentstyle
[twoside,11pt,myformat]
{
report
}
\title
{
Python/C API Reference
}
\title
{
Python/C API Reference
Manual
}
\input
{
boilerplate
}
\input
{
boilerplate
}
...
@@ -1058,13 +1058,13 @@ already imported.)
...
@@ -1058,13 +1058,13 @@ already imported.)
This is the structure type definition for frozen module descriptors,
This is the structure type definition for frozen module descriptors,
as generated by the
\code
{
freeze
}
utility (see
\file
{
Tools/freeze/
}
in
as generated by the
\code
{
freeze
}
utility (see
\file
{
Tools/freeze/
}
in
the Python source distribution). Its definition is:
the Python source distribution). Its definition is:
\b
code
\b
egin{verbatim}
\begin{verbatim}
struct
_
frozen
{
struct
_
frozen
{
char *name;
char *name;
unsigned char *code;
unsigned char *code;
int size;
int size;
}
;
}
;
\end{verbatim}
\ecode
\end{verbatim}
\end{ctypedesc}
\end{ctypedesc}
\begin{cvardesc}
{
struct
_
frozen *
}{
PyImport
_
FrozenModules
}
\begin{cvardesc}
{
struct
_
frozen *
}{
PyImport
_
FrozenModules
}
...
@@ -2047,21 +2047,21 @@ the current thread state must be manipulated explicitly.
...
@@ -2047,21 +2047,21 @@ the current thread state must be manipulated explicitly.
This is easy enough in most cases. Most code manipulating the global
This is easy enough in most cases. Most code manipulating the global
interpreter lock has the following simple structure:
interpreter lock has the following simple structure:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Save the thread state in a local variable.
Save the thread state in a local variable.
Release the interpreter lock.
Release the interpreter lock.
...Do some blocking I/O operation...
...Do some blocking I/O operation...
Reacquire the interpreter lock.
Reacquire the interpreter lock.
Restore the thread state from the local variable.
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:
This is so common that a pair of macros exists to simplify it:
\b
code
\b
egin{verbatim}
\begin{verbatim}
Py
_
BEGIN
_
ALLOW
_
THREADS
Py
_
BEGIN
_
ALLOW
_
THREADS
...Do some blocking I/O operation...
...Do some blocking I/O operation...
Py
_
END
_
ALLOW
_
THREADS
Py
_
END
_
ALLOW
_
THREADS
\end{verbatim}
\ecode
\end{verbatim}
The BEGIN macro opens a new block and declares a hidden local
The BEGIN macro opens a new block and declares a hidden local
variable; the END macro closes the block. Another advantage of using
variable; the END macro closes the block. Another advantage of using
...
@@ -2072,19 +2072,19 @@ manipulations.
...
@@ -2072,19 +2072,19 @@ manipulations.
When thread support is enabled, the block above expands to the
When thread support is enabled, the block above expands to the
following code:
following code:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
{
PyThreadState *
_
save;
PyThreadState *
_
save;
_
save = PyEval
_
SaveThread();
_
save = PyEval
_
SaveThread();
...Do some blocking I/O operation...
...Do some blocking I/O operation...
PyEval
_
RestoreThread(
_
save);
PyEval
_
RestoreThread(
_
save);
}
}
\end{verbatim}
\ecode
\end{verbatim}
Using even lower level primitives, we can get roughly the same effect
Using even lower level primitives, we can get roughly the same effect
as follows:
as follows:
\b
code
\b
egin{verbatim}
\begin{verbatim}
{
{
PyThreadState *
_
save;
PyThreadState *
_
save;
_
save = PyThreadState
_
Swap(NULL);
_
save = PyThreadState
_
Swap(NULL);
...
@@ -2093,7 +2093,7 @@ as follows:
...
@@ -2093,7 +2093,7 @@ as follows:
PyEval
_
AcquireLock();
PyEval
_
AcquireLock();
PyThreadState
_
Swap(
_
save);
PyThreadState
_
Swap(
_
save);
}
}
\end{verbatim}
\ecode
\end{verbatim}
There are some subtle differences; in particular,
There are some subtle differences; in particular,
\code
{
PyEval
_
RestoreThread()
}
saves and restores the value of the
\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