[libvirt] [PATCH 2/7] Add a virObjectLockable class holding a mutex

Eric Blake eblake at redhat.com
Tue Jan 15 00:01:18 UTC 2013


On 01/14/2013 03:26 AM, Daniel P. Berrange wrote:
>>
>> ...but this doesn't unlock anything.  You may want to document that the
>> user is required to unlock the object before losing the last reference.
> 
> So this isn't an issue, though we ought to document locking rules
> I guess.

Thanks for correcting me - you are right that there is no issue except
missing documentation.

>> Is it worth a sanity check that anyobj is actually an object of the
>> right class, before we blindly dereference something wrong due to a
>> coding error?
>>

> 
> Possibily, though what action should we take. These methods really
> need to be void, because it is not practical to check return values
> everywhere. Meanwhile we don't like to abort(). So that leaves the
> possibility of a VIR_WARN ?

Yep, a VIR_WARN in the logs is about the best we can do; but thankfully
the problem is most likely to hit during early development patches, when
someone is more likely to be paying attention to the logs.

-- 
Eric Blake   eblake 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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130114/ede2a6fe/attachment-0001.sig>


More information about the libvir-list mailing list