[Libguestfs] [nbdkit PATCH 3/6] connections: Add read/write lock over client I/O

Eric Blake eblake at redhat.com
Sat Nov 18 18:54:18 UTC 2017


On 11/17/2017 12:28 PM, Eric Blake wrote:
>> There's nothing wrong with this patch, but it might be easier to use
>> an attribute((cleanup)) handler to deal with the unlocking.  See these
>> links for how we do it in libguestfs:
> 
> Oh cool! Yes, that looks nicer.  Although the diffstat for doing so is
> larger, because it requires adding to new sub-function {} scopes and
> reindenting (we have two different locks in play here).
> 

Interestingly, it doesn't compile if you lack attribute((cleanup)).
Libguestfs has:

common/utils/cleanups.h:/* XXX no safe equivalent to
CLEANUP_GL_RECURSIVE_LOCK_UNLOCK */

and will fail to compile if the compiler lacks the attribute - arguably,
since no one has reported that compilation failure, it seems no one
cares about libguestfs that is not also in possession of modern gcc or
clang.  And we already have a configure-time check whether
attribute((cleanup)) is detected.  Is it okay to tighten that check to
now require a modern compiler for nbdkit, just to get nicer code?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171118/eccb23ef/attachment.sig>


More information about the Libguestfs mailing list