[pytango] 20/26: Use hub.loop and spawn a greenlet to handle the callback in gevent mode
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:16:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag v8.1.8
in repository pytango.
commit de7047a1c591ebf166f624c5bad0e7c49b9ebdba
Author: Jose Tiago Coutinho Macara <coutinho at esrf.fr>
Date: Wed Oct 28 13:13:04 2015 +0100
Use hub.loop and spawn a greenlet to handle the callback in gevent mode
---
src/boost/python/tango_gevent.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/boost/python/tango_gevent.py b/src/boost/python/tango_gevent.py
index 4fa6a6e..8c04e96 100644
--- a/src/boost/python/tango_gevent.py
+++ b/src/boost/python/tango_gevent.py
@@ -79,15 +79,17 @@ def get_event_loop():
def loop(queue):
while True:
- event = queue.get()
- f, args, kwargs = event
+ item = queue.get()
try:
- f(*args, **kwargs)
+ f, args, kwargs = item
+ gevent.spawn(f, *args, **kwargs)
except Exception as e:
sys.excepthook(*sys.exc_info())
def submit(fn, *args, **kwargs):
+ l_async = queue.hub.loop.async()
queue.put((fn, args, kwargs))
+ l_async.send()
queue = gevent.queue.Queue()
__event_loop = gevent.spawn(loop, queue)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list