Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
[deleted comment]
Try this sequence (it worked for me with gevent 1.0b2 on MacOS X):
h = gevent.get_hub()
a = h.loop.async()
a.start(lambda: None)
a.send()
h.wait(a) # Should return immediately
After this, a is no longer active. Call a.start(...) again to re-activate it
so that the loop will pay attention to it next time. a.start(...) also resets
a's pending state. You can always test a.pending before calling a.start(...)
if that matters somehow to your logic.
If you were doing the h.wait in a loop, I think the basic idea would be:
a = h.loop.async()
a.start(lambda: None)
<pass 'a' to some other greenlet or thread>
while True:
h.wait(a)
# reactivate the async watcher now to avoid potential race condition
a.start(lambda: None)
# Process...
<do all the required processing in response to 'a' being signaled; e.g., drain the *entire* queue that was filled by thread>
Hope this helps.
Original comment by vitaly.k...@gmail.com
on 2 Aug 2012 at 7:37
[deleted comment]
[deleted comment]
Migrated to http://github.com/SiteSupport/gevent/issues/130
Original comment by Denis.Bi...@gmail.com
on 14 Sep 2012 at 10:53
Original issue reported on code.google.com by
ipet...@gmail.com
on 16 May 2012 at 3:39