Code

Add patch from jimmyattime (issue #8)
authorScott Sanders <scott@jssjr.com>
Fri, 18 Nov 2011 16:11:35 +0000 (11:11 -0500)
committerScott Sanders <scott@jssjr.com>
Fri, 18 Nov 2011 16:11:35 +0000 (11:11 -0500)
This is certainly no worse than the previous usage of
pthread_mutex_lock, and will prevent the plugin from blocking. I'd like
to add better handling of failed locks in future commits.

src/write_graphite.c

index 57933e8dc3c518f77fa5f1aa72b6ba82f12b8436..8b5afb812bb62c47fe24af4378a10700db23ae99 100644 (file)
@@ -108,7 +108,7 @@ static int wg_send_buffer (struct wg_callback *cb)
                 status,
                 strerror (errno));
 
-        pthread_mutex_lock (&cb->send_lock);
+        pthread_mutex_trylock (&cb->send_lock);
 
         DEBUG ("write_graphite plugin: closing socket and restting fd "
                 "so reinit will occur");