[Openstack] eventlet weirdness

Devin Carlen devin.carlen at gmail.com
Tue Mar 6 01:55:38 UTC 2012


> If the libvirt API (or other Native API) has an async mode, what you
> can do is provide a synchronos, python based wrapper that does the 
> following.
> 
> register_request callback()
> async_call()
> sleep()
> 
> 

This can be set up like a more traditional multi-threaded model as well.  You can eventlet.sleep while waiting for the callback handler to notify the greenthread.  This of course assumes your i/o and callback are running in a different pthread (eventlet.tpool is fine). So it looks more like:

condition = threading.Condition() # or something like it
register_request_callback(condition)
async_call()
condition.wait()


I found this post to be enormously helpful in understanding some of the nuances of dealing with green thread and process thread synchronization and communication:
 
http://blog.devork.be/2011/03/synchronising-eventlets-and-threads.html 

Devin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120305/1a92ac72/attachment.html>


More information about the Openstack mailing list