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
e37d679e
Commit
e37d679e
authored
Jul 10, 2004
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bug #987835] Add documentation from PEP 311. (Untested TeX code.)
parent
46c4bf54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
Doc/api/init.tex
Doc/api/init.tex
+36
-0
No files found.
Doc/api/init.tex
View file @
e37d679e
...
...
@@ -699,6 +699,42 @@ interpreter lock has been created.
\versionadded
{
2.3
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyGILState
_
STATE
}{
PyGILState
_
Ensure
}{}
Ensure that the current thread is ready to call the Python
C API regardless of the current state of Python, or of its
thread lock. This may be called as many times as desired
by a thread as long as each call is matched with a call to
\cfunction
{
PyGILState
_
Release()
}
.
In general, other thread-related APIs may
be used between
\cfunction
{
PyGILState
_
Ensure()
}
and
\cfunction
{
PyGILState
_
Release()
}
calls as long as the
thread state is restored to its previous state before the Release().
For example, normal usage of the
\csimplemacro
{
Py
_
BEGIN
_
ALLOW
_
THREADS
}
and
\csimplemacro
{
Py
_
END
_
ALLOW
_
THREADS
}
macros is acceptable.
The return value is an opaque "handle" to the thread state when
\cfunction
{
PyGILState
_
Acquire()
}
was called, and must be passed to
\cfunction
{
PyGILState
_
Release()
}
to ensure Python is left in the same
state. Even though recursive calls are allowed, these handles
\emph
{
cannot
}
be shared - each unique call to
\cfunction
{
PyGILState
_
Ensure
}
must save the handle for its call to
\cfunction
{
PyGILState
_
Release
}
.
When the function returns, the current thread will hold the GIL.
Failure is a fatal error.
\versionadded
{
2.3
}
\end{cfuncdesc}
\begin{cfuncdesc}
{
void
}{
PyGILState
_
Release
}{
PyGILState
_
STATE
}
Release any resources previously acquired. After this call, Python's
state will be the same as it was prior to the corresponding
\cfunction
{
PyGILState
_
Ensure
}
call (but generally this state will be unknown to
the caller, hence the use of the GILState API.)
Every call to
\cfunction
{
PyGILState
_
Ensure()
}
must be matched by a call to
\cfunction
{
PyGILState
_
Release()
}
on the same thread.
\versionadded
{
2.3
}
\end{cfuncdesc}
\section
{
Profiling and Tracing
\label
{
profiling
}}
...
...
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