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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
63dce352
Commit
63dce352
authored
Nov 09, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using RAII for cypclass automatic lock acquisition
parent
961865dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+9
-10
No files found.
Cython/Compiler/ExprNodes.py
View file @
63dce352
...
...
@@ -14197,20 +14197,19 @@ class CoerceToLockedNode(CoercionNode):
return
self
.
arg
.
may_be_none
()
def
generate_result_code
(
self
,
code
):
# Create a scope to use scope bound resource management (RAII).
code
.
putln
(
"{"
)
# Since each lock guard has its onw scope,
# a prefix is enough to prevent name collisions.
guard_code
=
"%sguard"
%
Naming
.
cypclass_lock_guard_prefix
# Acquire the lock.
if
self
.
rlock_only
:
code
.
putln
(
"Cy_
rlock_guard %s(%s);"
%
(
guard_code
,
self
.
result
()
))
code
.
putln
(
"Cy_
RLOCK(%s);"
%
self
.
result
(
))
else
:
code
.
putln
(
"Cy_
wlock_guard %s(%s);"
%
(
guard_code
,
self
.
result
()
))
code
.
putln
(
"Cy_
WLOCK(%s);"
%
self
.
result
(
))
def
generate_disposal_code
(
self
,
code
):
# Close the scope to release the lock.
code
.
putln
(
"}"
)
# Release the lock.
if
self
.
rlock_only
:
code
.
putln
(
"Cy_UNRLOCK(%s);"
%
self
.
result
())
else
:
code
.
putln
(
"Cy_UNWLOCK(%s);"
%
self
.
result
())
# The subexpressions of self.arg are disposed-of and freed
# as soon as self.arg is evaluated because it is a temporary.
...
...
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