Displaying 4 results from an estimated 4 matches for "errors_lock".
2018 Jan 25
1
[nbdkit PATCH] errors: Use lighter-weight locking
...ed Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,21 +44,16 @@
#include "nbdkit-plugin.h"
#include "internal.h"
-/* Used to group piecemeal message construction into atomic output. */
-static pthread_mutex_t errors_lock = PTHREAD_MUTEX_INITIALIZER;
-
static void
lock (void)
{
- int r = pthread_mutex_lock (&errors_lock);
- assert (!r);
+ flockfile (stderr);
}
static void
unlock (void)
{
- int r = pthread_mutex_unlock (&errors_lock);
- assert (!r);
+ funlockfile (stderr);
}
/* Called with lo...
2017 Nov 17
1
Re: [nbdkit PATCH 1/4] errors: Avoid interleaved errors from parallel threads
...>
> #include <errno.h>
> +#include <assert.h>
> +#include <pthread.h>
>
> #include "nbdkit-plugin.h"
> #include "internal.h"
>
> +/* Used to group piecemeal message construction into atomic output. */
> +static pthread_mutex_t errors_lock = PTHREAD_MUTEX_INITIALIZER;
> +
> +static void
> +lock (void)
> +{
> + int r = pthread_mutex_lock(&errors_lock);
> + assert(!r);
> +}
> +
> +static void
> +unlock (void)
> +{
> + int r = pthread_mutex_unlock(&errors_lock);
> + assert(!r);
Spaces...
2017 Nov 17
7
[nbdkit PATCH 0/4] thread-safety issues prior to parallel handling
These patches should be ready to go in now; I will also post my
work-in-progress for enabling full parallel handling that depends
on these, but with that series, I was still getting crashes or
hangs with test-socket-activation (I think I've nailed all the
crashes I've seen, but the hang is rather insidious; see my other
email
2017 Nov 17
0
[nbdkit PATCH 1/4] errors: Avoid interleaved errors from parallel threads
...clude <stdarg.h>
#include <string.h>
#include <errno.h>
+#include <assert.h>
+#include <pthread.h>
#include "nbdkit-plugin.h"
#include "internal.h"
+/* Used to group piecemeal message construction into atomic output. */
+static pthread_mutex_t errors_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void
+lock (void)
+{
+ int r = pthread_mutex_lock(&errors_lock);
+ assert(!r);
+}
+
+static void
+unlock (void)
+{
+ int r = pthread_mutex_unlock(&errors_lock);
+ assert(!r);
+}
+
+/* Called with lock taken. */
static void
prologue (const char *t...