Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
ccd587b6
Commit
ccd587b6
authored
Aug 23, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: clarify a bit more what it means to acquire/release the GIL
parent
70c44041
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
docs/src/userguide/external_C_code.rst
docs/src/userguide/external_C_code.rst
+12
-2
No files found.
docs/src/userguide/external_C_code.rst
View file @
ccd587b6
...
@@ -471,8 +471,18 @@ Acquiring and Releasing the GIL
...
@@ -471,8 +471,18 @@ Acquiring and Releasing the GIL
Cython provides facilities for acquiring and releasing the
Cython provides facilities for acquiring and releasing the
`Global Interpreter Lock (GIL) <http://docs.python.org/dev/glossary.html#term-global-interpreter-lock>`_.
`Global Interpreter Lock (GIL) <http://docs.python.org/dev/glossary.html#term-global-interpreter-lock>`_.
This may be useful when calling into (external C) code that may block, or when wanting to use Python from a
This may be useful when calling from multi-threaded code into
C callback.
(external C) code that may block, or when wanting to use Python
from a (native) C thread callback. Releasing the GIL should
obviously only be done for thread-safe code or for code that
uses other means of protection against race conditions and
concurrency issues.
Note that acquiring the GIL is a blocking thread-synchronising
operation, and therefore potentially costly. It might not be
worth releasing the GIL for minor calculations. Usually, I/O
operations and substantial computations in parallel code will
benefit from it.
.. _nogil:
.. _nogil:
...
...
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