[libvirt] [PATCH 2/2] Java bindings for domain events

David Lively dlively at virtualiron.com
Tue Nov 18 16:18:38 UTC 2008


This patch allows the remote driver to work with an asynchronous
EventImpl (it's the only one using an externally-supplied one), assuming
libvirt is compiled with pthread support.  (Without pthreads, this code
is harmless in a single-threaded environment.)

Basically it uses a mutex to protect reads from the RPC socket in such a
way that message reads (in their entirety) are done atomically
(otherwise the remoteDomainEventFired() can race the call() code that
reads replies & events).

In addition, I update the EventImpl handle to prevent
remoteDomainEventFired() from being called everytime a reply is sent.
(This helps us dispatch events in a timely manner, though it's not
strictly necessary.  Without it, any events coming in during a call()
won't be dispatched until the call drops the socket lock (because
remoteDomainEventFired() will be stuck awaiting the lock).

Dave

-------------- next part --------------
A non-text attachment was scrubbed...
Name: allow-async-eventimpl.patch
Type: text/x-patch
Size: 5942 bytes
Desc: 
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20081118/8025fc8e/attachment-0001.bin>


More information about the libvir-list mailing list