Commit 17815bd5 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add a "poll" method to the EventClient class so that I can request a

single event at a time, and process that event inline, rather then
within a callback.
parent a6b64d13
......@@ -508,5 +508,25 @@ class EventClient:
pass
return
def poll(self):
"""
Polling interface; returns events to caller, one at a time.
"""
while True:
try:
#
# First see if anything not yet delivered.
#
ev = CallbackIterator(self.handle).next()
return ev;
except StopIteration, e:
pass
rc = c_event_poll_blocking(self.handle, 0)
if rc != 0:
sys.stderr.write("c_event_poll_blocking: " + str(rc) + "\n")
raise IOError, "Reading events"
pass
pass
......@@ -212,5 +212,25 @@ class EventClient:
pass
return
def poll(self):
"""
Polling interface; returns events to caller, one at a time.
"""
while True:
try:
#
# First see if anything not yet delivered.
#
ev = CallbackIterator(self.handle).next()
return ev;
except StopIteration, e:
pass
rc = c_event_poll_blocking(self.handle, 0)
if rc != 0:
sys.stderr.write("c_event_poll_blocking: " + str(rc) + "\n")
raise IOError, "Reading events"
pass
pass
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment