Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
2f6662e1
Commit
2f6662e1
authored
Apr 25, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python 2.7.x fixes for new gil_scoped_release
parent
084ca0e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
include/pybind11/pybind11.h
+15
-4
No files found.
include/pybind11/pybind11.h
View file @
2f6662e1
...
...
@@ -1122,15 +1122,26 @@ class gil_scoped_release {
public
:
gil_scoped_release
(
bool
disassoc
=
false
)
:
disassoc
(
disassoc
)
{
tstate
=
PyEval_SaveThread
();
if
(
disassoc
)
PyThread_set_key_value
(
detail
::
get_internals
().
tstate
,
nullptr
);
if
(
disassoc
)
{
int
key
=
detail
::
get_internals
().
tstate
;
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value
(
key
);
#else
PyThread_set_key_value
(
key
,
nullptr
);
#endif
}
}
~
gil_scoped_release
()
{
if
(
!
tstate
)
return
;
PyEval_RestoreThread
(
tstate
);
if
(
disassoc
)
PyThread_set_key_value
(
detail
::
get_internals
().
tstate
,
tstate
);
if
(
disassoc
)
{
int
key
=
detail
::
get_internals
().
tstate
;
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value
(
key
);
#endif
PyThread_set_key_value
(
key
,
tstate
);
}
}
private
:
PyThreadState
*
tstate
;
...
...
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