[Libguestfs] [nbdkit PATCH 1/4] errors: Avoid interleaved errors from parallel threads

Eric Blake eblake at redhat.com
Fri Nov 17 18:32:34 UTC 2017


On 11/17/2017 02:50 AM, Richard W.M. Jones wrote:
> On Thu, Nov 16, 2017 at 09:13:55PM -0600, Eric Blake wrote:
>> Since we construct our error/debug messages via multiple calls
>> to stdio primitives, we are at risk of multiple threads interleaving
>> their output if they try to output at once.  Add a mutex to group
>> related outputs into an atomic chunk.
>>
>> Signed-off-by: Eric Blake <eblake at redhat.com>
>> ---

>> +static void
>> +unlock (void)
>> +{
>> +  int r = pthread_mutex_unlock(&errors_lock);
>> +  assert(!r);
> 
> Spaces between assert (in 2 cases above) and parens.
> 
> The rest of this patch is fine, so ACK.

Yep, I have to remind myself which coding style I'm under, especially as
I've posted patches to three projects with three different styles this
week (all in the name of getting nbd-server, qemu-nbd, and nbdkit to
better integrate with one another).

-- 
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/20171117/d00a195f/attachment.sig>


More information about the Libguestfs mailing list