openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #08323
Re: eventlet weirdness
> 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
References