X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fping.c;h=c97571b85c066c695fd66369269b6035bba00097;hb=f14feb1eddfe5760a64640b98ab7bbc5c493f614;hp=216feda1f5d688fd79766822937cb75d2d3608e8;hpb=e30c4b09f2ba06ed279d7ddfdc3714e1b3ab3a06;p=collectd.git diff --git a/src/ping.c b/src/ping.c index 216feda1..c97571b8 100644 --- a/src/ping.c +++ b/src/ping.c @@ -241,7 +241,7 @@ static int ping_dispatch_all (pingobj_t *pingobj) /* {{{ */ static void *ping_thread (void *arg) /* {{{ */ { - static pingobj_t *pingobj = NULL; + pingobj_t *pingobj = NULL; struct timeval tv_begin; struct timeval tv_end; @@ -359,7 +359,7 @@ static void *ping_thread (void *arg) /* {{{ */ * `ts_wait'. */ time_calc (&ts_wait, &ts_int, &tv_begin, &tv_end); - status = pthread_cond_timedwait (&ping_cond, &ping_lock, &ts_wait); + pthread_cond_timedwait (&ping_cond, &ping_lock, &ts_wait); if (ping_thread_loop <= 0) break; } /* while (ping_thread_loop > 0) */ @@ -421,8 +421,10 @@ static int stop_thread (void) /* {{{ */ status = -1; } + pthread_mutex_lock (&ping_lock); memset (&ping_thread_id, 0, sizeof (ping_thread_id)); ping_thread_error = 0; + pthread_mutex_unlock (&ping_lock); return (status); } /* }}} int stop_thread */