diff --git a/src/ping.c b/src/ping.c
index 216feda1f5d688fd79766822937cb75d2d3608e8..5df82f475cb935383d629a23186bee2754382979 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
static void *ping_thread (void *arg) /* {{{ */
{
- static pingobj_t *pingobj = NULL;
+ pingobj_t *pingobj = NULL;
struct timeval tv_begin;
struct timeval tv_end;
* `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) */
if (ping_thread_loop != 0)
{
pthread_mutex_unlock (&ping_lock);
- return (-1);
+ return (0);
}
ping_thread_loop = 1;
pthread_mutex_unlock (&ping_lock);
return (-1);
}
-
+
pthread_mutex_unlock (&ping_lock);
return (0);
} /* }}} int start_thread */
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 */
"Will use a timeout of %gs.", ping_timeout);
}
- if (start_thread () != 0)
- return (-1);
-
- return (0);
+ return (start_thread ());
} /* }}} int ping_init */
static int config_set_string (const char *name, /* {{{ */