<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">If the libvirt API (or other Native API) has an async mode, what you<span><div><div><div>can do is provide a synchronos, python based wrapper that does the </div><div>following.</div><div><br></div><div>register_request callback()</div><div>async_call()</div><div>sleep()</div></div></div></span></blockquote><div>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:</div><div><br></div><div>condition = threading.Condition() # or something like it</div><div>register_request_callback(condition)</div><div>async_call()</div><div>condition.wait()</div><div><br></div><div><br></div><div>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:</div><div> </div><div><a href="http://blog.devork.be/2011/03/synchronising-eventlets-and-threads.html">http://blog.devork.be/2011/03/synchronising-eventlets-and-threads.html</a> </div><div><br></div><div>Devin</div><div><br>
</div>