Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
fa3600c1
Commit
fa3600c1
authored
Jan 27, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up thunk management logic.
Allow thunks to take args. Don't hold trigger lock when calling thunks.
parent
397b8b5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
src/ZEO/zrpc/trigger.py
src/ZEO/zrpc/trigger.py
+22
-18
No files found.
src/ZEO/zrpc/trigger.py
View file @
fa3600c1
...
...
@@ -12,6 +12,8 @@
#
##############################################################################
from
__future__
import
with_statement
import
asyncore
import
os
import
socket
...
...
@@ -95,14 +97,15 @@ class _triggerbase(object):
def
_close
(
self
):
# see close() above; subclass must supply
raise
NotImplementedError
def
pull_trigger
(
self
,
thunk
=
None
):
def
pull_trigger
(
self
,
*
thunk
):
if
thunk
:
self
.
lock
.
acquire
()
try
:
with
self
.
lock
:
self
.
thunks
.
append
(
thunk
)
finally
:
self
.
lock
.
release
()
self
.
_physical_pull
()
try
:
self
.
_physical_pull
()
except
Exception
:
if
not
self
.
_closed
:
raise
# Subclass must supply _physical_pull, which does whatever the OS
# needs to do to provoke the "write" end of the trigger.
...
...
@@ -114,18 +117,19 @@ class _triggerbase(object):
self
.
recv
(
8192
)
except
socket
.
error
:
return
self
.
lock
.
acquire
()
try
:
for
thunk
in
self
.
thunks
:
try
:
thunk
()
except
:
nil
,
t
,
v
,
tbinfo
=
asyncore
.
compact_traceback
()
print
(
'exception in trigger thunk:'
' (%s:%s %s)'
%
(
t
,
v
,
tbinfo
))
self
.
thunks
=
[]
finally
:
self
.
lock
.
release
()
while
1
:
with
self
.
lock
:
if
self
.
thunks
:
thunk
=
self
.
thunks
.
pop
(
0
)
else
:
return
try
:
thunk
[
0
](
*
thunk
[
1
:])
except
:
nil
,
t
,
v
,
tbinfo
=
asyncore
.
compact_traceback
()
print
(
'exception in trigger thunk:'
' (%s:%s %s)'
%
(
t
,
v
,
tbinfo
))
def
__repr__
(
self
):
return
'<select-trigger (%s) at %x>'
%
(
self
.
kind
,
positive_id
(
self
))
...
...
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