[libvirt] [PATCH 8/8] Only add the timer when a callback is registered

Eric Blake eblake at redhat.com
Wed Dec 14 22:18:41 UTC 2011


On 12/13/2011 05:38 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> The lifetime of the virDomainEventState object is tied to
> the lifetime of the driver, which in stateless drivers is
> tied to the lifetime of the virConnectPtr.
> 
> If we add & remove a timer when allocating/freeing the
> virDomainEventState object, we can get a situation where
> the timer still triggers once after virDomainEventState
> has been freed. The timeout callback can't keep a ref
> on the event state though, since that would be a circular
> reference.
> 
> The trick is to only register the timer when a callback
> is registered with the event state & remove the timer
> when the callback is unregistered.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111214/d36e63cd/attachment-0001.sig>


More information about the libvir-list mailing list