Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Kirill Smelkov
gevent
Commits
4fcd6f8f
Commit
4fcd6f8f
authored
Dec 18, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the non-reentrancy threadlocal. sadly that slows semaphore down to 0.5usec
parent
111affcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
gevent/lock.py
gevent/lock.py
+16
-5
No files found.
gevent/lock.py
View file @
4fcd6f8f
...
@@ -26,20 +26,31 @@ if PYPY:
...
@@ -26,20 +26,31 @@ if PYPY:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
_owner
=
None
self
.
_owner
=
None
self
.
_block
=
_allocate_lock
()
self
.
_block
=
_allocate_lock
()
self
.
_locking
=
0
self
.
_locking
=
{}
self
.
_count
=
0
self
.
_count
=
0
def
untraceable
(
f
):
def
untraceable
(
f
):
# Don't allow re-entry to these functions, as can
# Don't allow re-entry to these functions
in a single thread
, as can
# happen if a sys.settrace is used
# happen if a sys.settrace is used
def
wrapper
(
self
):
def
wrapper
(
self
):
if
self
.
_locking
:
me
=
_get_ident
()
try
:
count
=
self
.
_locking
[
me
]
except
KeyError
:
count
=
self
.
_locking
[
me
]
=
1
else
:
count
=
self
.
_locking
[
me
]
=
count
+
1
if
count
:
return
return
try
:
try
:
self
.
_locking
+=
1
return
f
(
self
)
return
f
(
self
)
finally
:
finally
:
self
.
_locking
-=
1
count
=
count
-
1
if
not
count
:
del
self
.
_locking
[
me
]
else
:
self
.
_locking
[
me
]
=
count
return
wrapper
return
wrapper
@
untraceable
@
untraceable
...
...
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