From: Florian Forster Date: Mon, 29 Jan 2007 10:02:41 +0000 (+0100) Subject: unixsock plugin: Make created threads to be `detached'. X-Git-Tag: collectd-4.0.0~211^2~6 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=c4aa9803e286657c34d4c16429ef79f36557c3e2 unixsock plugin: Make created threads to be `detached'. --- diff --git a/src/unixsock.c b/src/unixsock.c index e6017ef2..b2663f14 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -264,20 +264,12 @@ static int cache_update (const data_set_t *ds, const value_list_t *vl) / (vl->time - vc->time); } - DBG ("name = %s; old counter: %llu; new counter: %llu; rate: %lf;", - name, - vc->counter[i], vl->values[i].counter, - vc->gauge[i]); - vc->counter[i] = vl->values[i].counter; } else if (ds->ds[i].type == DS_TYPE_GAUGE) { vc->gauge[i] = vl->values[i].gauge; vc->counter[i] = 0; - - DBG ("name, %s; gauge: %lf;", - name, vc->gauge[i]); } else { @@ -569,6 +561,7 @@ static void *us_server_thread (void *arg) int status; int *remote_fd; pthread_t th; + pthread_attr_t th_attr; if (us_open_socket () != 0) pthread_exit ((void *) 1); @@ -601,7 +594,10 @@ static void *us_server_thread (void *arg) DBG ("Spawning child to handle connection on fd #%i", *remote_fd); - status = pthread_create (&th, NULL, us_handle_client, (void *) remote_fd); + pthread_attr_init (&th_attr); + pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED); + + status = pthread_create (&th, &th_attr, us_handle_client, (void *) remote_fd); if (status != 0) { syslog (LOG_WARNING, "unixsock plugin: pthread_create failed: %s",