Commit af777e39 authored by Geoff Simmons's avatar Geoff Simmons

set thread names, when available

parent 132dae00
......@@ -200,6 +200,7 @@ AC_CHECK_FUNCS([timegm])
AC_CHECK_FUNCS([nanosleep])
AC_CHECK_FUNCS([setppriv])
AC_CHECK_FUNCS([getline])
AC_CHECK_FUNCS([pthread_setname_np])
save_LIBS="${LIBS}"
LIBS="${PTHREAD_LIBS}"
......
......@@ -29,6 +29,8 @@
*
*/
#include "config.h"
#include <syslog.h>
#include <pthread.h>
#include <errno.h>
......@@ -73,6 +75,7 @@ monitor_cleanup(void *arg)
static void *
monitor_main(void *arg)
{
thread_setname(pthread_self(), "vevent_monitor");
LOG_Log(LOG_NOTICE, "Monitor thread running every %u secs",
config.monitor_interval);
run = 1;
......
......@@ -68,6 +68,14 @@
#define DEFAULT_CFORMAT \
"%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\""
#ifdef HAVE_PTHREAD_SETNAME_NP
#define thread_setname(thr,name) pthread_setname_np((thr),(name))
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
#define thread_setname(thr,name) pthread_set_name_np((thr),(name))
#else
#define thread_setname(thr,name) do { (void)(thr); (void)(name); } while(0)
#endif
struct sigaction default_action;
int tag2idx[MAX_VSL_TAG];
......
......@@ -30,6 +30,8 @@
*
*/
#include "config.h"
#include <pthread.h>
#include <stdlib.h>
#include <syslog.h>
......@@ -273,6 +275,7 @@ static void
LOG_Log0(LOG_NOTICE, "Writer thread starting");
CHECK_OBJ_NOTNULL(wrt, WRITER_DATA_MAGIC);
thread_setname(pthread_self(), "vevent_writer");
wrt->state = WRT_INITIALIZING;
VSTAILQ_INIT(&wrt_freetx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment