[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]