]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Set the thread name before detaching the thread 2762/head
authorMichael Kaufmann <mail@michael-kaufmann.ch>
Thu, 3 May 2018 20:20:33 +0000 (22:20 +0200)
committerMichael Kaufmann <mail@michael-kaufmann.ch>
Thu, 3 Oct 2019 09:38:30 +0000 (11:38 +0200)
pthread_setname_np() does not work reliably when a thread has been
created in a detached state. Set the thread name first, and then call
pthread_detach() afterwards (if necessary).

This prevents error messages like this one:
set_thread_name("unixsock conn"): No such process

24 files changed:
src/amqp.c
src/amqp1.c
src/connectivity.c
src/daemon/plugin.c
src/daemon/plugin.h
src/daemon/plugin_mock.c
src/dns.c
src/email.c
src/exec.c
src/gmond.c
src/gps.c
src/ipmi.c
src/mcelog.c
src/mqtt.c
src/network.c
src/pinba.c
src/ping.c
src/procevent.c
src/python.c
src/rrdtool.c
src/sigrok.c
src/sysevent.c
src/unixsock.c
src/utils/ovs/ovs.c

index 2077d57b3d5e870caa6e089456e646810c1e5ce7..481d34e34d0ebaf158b516af066ecc390ffa4943 100644 (file)
@@ -683,8 +683,8 @@ static int camqp_subscribe_init(camqp_config_t *conf) /* {{{ */
   tmp = subscriber_threads + subscriber_threads_num;
   memset(tmp, 0, sizeof(*tmp));
 
-  status = plugin_thread_create(tmp, /* attr = */ NULL, camqp_subscribe_thread,
-                                conf, "amqp subscribe");
+  status =
+      plugin_thread_create(tmp, camqp_subscribe_thread, conf, "amqp subscribe");
   if (status != 0) {
     ERROR("amqp plugin: pthread_create failed: %s", STRERROR(status));
     return status;
index 67c96b750256550c90fee2776a338b170695c058..c34ed217f9d26f46a10a26ef272ca5a4efc9f5a6 100644 (file)
@@ -735,9 +735,8 @@ static int amqp1_init(void) /* {{{ */
   if (proactor == NULL) {
     pthread_mutex_init(&send_lock, /* attr = */ NULL);
     /* start_thread */
-    int status =
-        plugin_thread_create(&event_thread_id, NULL /* no attributes */,
-                             event_thread, NULL /* no argument */, "handle");
+    int status = plugin_thread_create(&event_thread_id, event_thread,
+                                      NULL /* no argument */, "handle");
     if (status != 0) {
       ERROR("amqp1 plugin: pthread_create failed: %s", STRERRNO);
     } else {
index 45b65aab5b09c1c5ba35110bbff618f6144de153..8da7002fd6722f05556c38b88fb0b98a11c6d9a1 100644 (file)
@@ -743,7 +743,7 @@ static int start_netlink_thread(void) /* {{{ */
   }
 
   status = plugin_thread_create(&connectivity_netlink_thread_id,
-                                /* attr = */ NULL, connectivity_netlink_thread,
+                                connectivity_netlink_thread,
                                 /* arg = */ (void *)0, "connectivity");
   if (status != 0) {
     connectivity_netlink_thread_loop = 0;
@@ -778,10 +778,9 @@ static int start_dequeue_thread(void) /* {{{ */
 
   connectivity_dequeue_thread_loop = 1;
 
-  int status =
-      plugin_thread_create(&connectivity_dequeue_thread_id,
-                           /* attr = */ NULL, connectivity_dequeue_thread,
-                           /* arg = */ (void *)0, "connectivity");
+  int status = plugin_thread_create(&connectivity_dequeue_thread_id,
+                                    connectivity_dequeue_thread,
+                                    /* arg = */ (void *)0, "connectivity");
   if (status != 0) {
     connectivity_dequeue_thread_loop = 0;
     ERROR("connectivity plugin: Starting dequeue thread failed.");
index 52cb0a4b7174b5344fa8a31c3082f11a9a17c6e9..bc560aca0136a88e4beb4f908bae326334049368 100644 (file)
@@ -1357,7 +1357,8 @@ EXPORT int plugin_register_cache_event(const char *name,
   user_data_t user_data;
   if (ud == NULL) {
     user_data = (user_data_t){
-        .data = NULL, .free_func = NULL,
+        .data = NULL,
+        .free_func = NULL,
     };
   } else {
     user_data = *ud;
@@ -2728,9 +2729,8 @@ static void *plugin_thread_start(void *arg) {
   return start_routine(plugin_arg);
 } /* void *plugin_thread_start */
 
-int plugin_thread_create(pthread_t *thread, const pthread_attr_t *attr,
-                         void *(*start_routine)(void *), void *arg,
-                         char const *name) {
+int plugin_thread_create(pthread_t *thread, void *(*start_routine)(void *),
+                         void *arg, char const *name) {
   plugin_thread_t *plugin_thread;
 
   plugin_thread = malloc(sizeof(*plugin_thread));
@@ -2741,7 +2741,7 @@ int plugin_thread_create(pthread_t *thread, const pthread_attr_t *attr,
   plugin_thread->start_routine = start_routine;
   plugin_thread->arg = arg;
 
-  int ret = pthread_create(thread, attr, plugin_thread_start, plugin_thread);
+  int ret = pthread_create(thread, NULL, plugin_thread_start, plugin_thread);
   if (ret != 0) {
     sfree(plugin_thread);
     return ret;
index af3693dd64edb92f939f83a7245ccb70a5f712d6..0dbefdab03c3ef3c93e07c0067096699c3576c5c 100644 (file)
@@ -473,9 +473,8 @@ cdtime_t plugin_get_interval(void);
  * Context-aware thread management.
  */
 
-int plugin_thread_create(pthread_t *thread, const pthread_attr_t *attr,
-                         void *(*start_routine)(void *), void *arg,
-                         char const *name);
+int plugin_thread_create(pthread_t *thread, void *(*start_routine)(void *),
+                         void *arg, char const *name);
 
 /*
  * Plugins need to implement this
index 69d5e28afdfb675ef87602389a0338005a3b6890..311ccdfd905fc386afd258568c24587f2933b695 100644 (file)
@@ -233,7 +233,6 @@ plugin_ctx_t plugin_set_ctx(plugin_ctx_t ctx) {
 cdtime_t plugin_get_interval(void) { return mock_context.interval; }
 
 int plugin_thread_create(__attribute__((unused)) pthread_t *thread,
-                         __attribute__((unused)) const pthread_attr_t *attr,
                          __attribute__((unused)) void *(*start_routine)(void *),
                          __attribute__((unused)) void *arg,
                          __attribute__((unused)) char const *name) {
index dad0be2538a7cf720635937bebd63ff239845e14..56b3dce10fd54a8087a20d0446435d6a58c1cf75 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -284,7 +284,7 @@ static int dns_init(void) {
   if (listen_thread_init != 0)
     return -1;
 
-  status = plugin_thread_create(&listen_thread, NULL, dns_child_loop, (void *)0,
+  status = plugin_thread_create(&listen_thread, dns_child_loop, (void *)0,
                                 "dns listen");
   if (status != 0) {
     ERROR("dns plugin: pthread_create failed: %s", STRERRNO);
index 53602053f68ff5dbec087cd8c77358423a3f8436..9cb76d14cb93c270cc12be1247775a5993dd5117 100644 (file)
@@ -428,14 +428,9 @@ static void *open_connection(void __attribute__((unused)) * arg) {
   }
 
   { /* initialize collector threads */
-    pthread_attr_t ptattr;
-
     conns.head = NULL;
     conns.tail = NULL;
 
-    pthread_attr_init(&ptattr);
-    pthread_attr_setdetachstate(&ptattr, PTHREAD_CREATE_DETACHED);
-
     available_collectors = max_conns;
 
     collectors = smalloc(max_conns * sizeof(*collectors));
@@ -444,14 +439,14 @@ static void *open_connection(void __attribute__((unused)) * arg) {
       collectors[i] = smalloc(sizeof(*collectors[i]));
       collectors[i]->socket = NULL;
 
-      if (plugin_thread_create(&collectors[i]->thread, &ptattr, collect,
-                               collectors[i], "email collector") != 0) {
+      if (plugin_thread_create(&collectors[i]->thread, collect, collectors[i],
+                               "email collector") == 0) {
+        pthread_detach(collectors[i]->thread);
+      } else {
         log_err("plugin_thread_create() failed: %s", STRERRNO);
         collectors[i]->thread = (pthread_t)0;
       }
     }
-
-    pthread_attr_destroy(&ptattr);
   }
 
   while (1) {
@@ -523,7 +518,7 @@ static void *open_connection(void __attribute__((unused)) * arg) {
 } /* static void *open_connection (void *) */
 
 static int email_init(void) {
-  if (plugin_thread_create(&connector, NULL, open_connection, NULL,
+  if (plugin_thread_create(&connector, open_connection, NULL,
                            "email listener") != 0) {
     disabled = 1;
     log_err("plugin_thread_create() failed: %s", STRERRNO);
index 9574f2c4bf4a252dd87ae76910f3dc4f8057ebd6..24db80ff618bef1ef6666bccb5a072f02671ae52 100644 (file)
@@ -834,7 +834,6 @@ static int exec_read(void) /* {{{ */
 {
   for (program_list_t *pl = pl_head; pl != NULL; pl = pl->next) {
     pthread_t t;
-    pthread_attr_t attr;
 
     /* Only execute `normal' style executables here. */
     if ((pl->flags & PL_NORMAL) == 0)
@@ -849,14 +848,13 @@ static int exec_read(void) /* {{{ */
     pl->flags |= PL_RUNNING;
     pthread_mutex_unlock(&pl_lock);
 
-    pthread_attr_init(&attr);
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     int status =
-        plugin_thread_create(&t, &attr, exec_read_one, (void *)pl, "exec read");
-    if (status != 0) {
+        plugin_thread_create(&t, exec_read_one, (void *)pl, "exec read");
+    if (status == 0) {
+      pthread_detach(t);
+    } else {
       ERROR("exec plugin: plugin_thread_create failed.");
     }
-    pthread_attr_destroy(&attr);
   } /* for (pl) */
 
   return 0;
@@ -868,7 +866,6 @@ static int exec_notification(const notification_t *n, /* {{{ */
 
   for (program_list_t *pl = pl_head; pl != NULL; pl = pl->next) {
     pthread_t t;
-    pthread_attr_t attr;
 
     /* Only execute `notification' style executables here. */
     if ((pl->flags & PL_NOTIF_ACTION) == 0)
@@ -892,14 +889,13 @@ static int exec_notification(const notification_t *n, /* {{{ */
     pln->n.meta = NULL;
     plugin_notification_meta_copy(&pln->n, n);
 
-    pthread_attr_init(&attr);
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    int status = plugin_thread_create(&t, &attr, exec_notification_one,
-                                      (void *)pln, "exec notify");
-    if (status != 0) {
+    int status = plugin_thread_create(&t, exec_notification_one, (void *)pln,
+                                      "exec notify");
+    if (status == 0) {
+      pthread_detach(t);
+    } else {
       ERROR("exec plugin: plugin_thread_create failed.");
     }
-    pthread_attr_destroy(&attr);
   } /* for (pl) */
 
   return 0;
index 03dedcca606249c7b771f7511dd75f5c8a427a9a..4210e30d0877ae539d14d4a26b34500170bd8f3a 100644 (file)
@@ -789,9 +789,8 @@ static int mc_receive_thread_start(void) /* {{{ */
 
   mc_receive_thread_loop = 1;
 
-  status =
-      plugin_thread_create(&mc_receive_thread_id, /* attr = */ NULL,
-                           mc_receive_thread, /* args = */ NULL, "gmond recv");
+  status = plugin_thread_create(&mc_receive_thread_id, mc_receive_thread,
+                                /* args = */ NULL, "gmond recv");
   if (status != 0) {
     ERROR("gmond plugin: Starting receive thread failed.");
     mc_receive_thread_loop = 0;
index 4d65176836b24946e135a2112d7cfea147236aa4..11cbcfe88f0b6feb75230648543b26ce1e4141f9 100644 (file)
--- a/src/gps.c
+++ b/src/gps.c
@@ -287,8 +287,7 @@ static int cgps_init(void) {
         CDTIME_T_TO_DOUBLE(cgps_config_data.timeout),
         CDTIME_T_TO_DOUBLE(cgps_config_data.pause_connect));
 
-  status =
-      plugin_thread_create(&cgps_thread_id, NULL, cgps_thread, NULL, "gps");
+  status = plugin_thread_create(&cgps_thread_id, cgps_thread, NULL, "gps");
   if (status != 0) {
     ERROR("gps plugin: pthread_create() failed.");
     return -1;
index db0e775fe91752beead1076abee09752f40e4a9e..6e3db951a3631827346afdbaa1affdf22ea942eb 100644 (file)
@@ -1275,8 +1275,7 @@ static int c_ipmi_init(void) {
     st->init_in_progress = cycles;
     st->active = true;
 
-    status = plugin_thread_create(&st->thread_id, /* attr = */ NULL,
-                                  c_ipmi_thread_main,
+    status = plugin_thread_create(&st->thread_id, c_ipmi_thread_main,
                                   /* user data = */ (void *)st, "ipmi");
 
     if (status != 0) {
index d71195f0cf7e6d3f47809b32a86f7dff7fea8372..f362b1a28b54599ba626722800e2162e761bcd80 100644 (file)
@@ -636,8 +636,8 @@ static int mcelog_init(void) {
   }
 
   if (strlen(socket_adapter.unix_sock.sun_path)) {
-    if (plugin_thread_create(&g_mcelog_config.tid, NULL, poll_worker, NULL,
-                             NULL) != 0) {
+    if (plugin_thread_create(&g_mcelog_config.tid, poll_worker, NULL, NULL) !=
+        0) {
       ERROR(MCELOG_PLUGIN ": Error creating poll thread.");
       return -1;
     }
index a44f4c829d5835a6c44e15566e3f1985707cc058..eb64fbadbd3021075d8f9aaf43da20f93cbe8ebe 100644 (file)
@@ -744,7 +744,6 @@ static int mqtt_init(void) {
       continue;
 
     status = plugin_thread_create(&subscribers[i]->thread,
-                                  /* attrs = */ NULL,
                                   /* func  = */ subscribers_thread,
                                   /* args  = */ subscribers[i],
                                   /* name  = */ "mqtt");
index 8acf84b1bb67434925c8e3075fe4b7a04182b5c5..4dd1cb437fb0913ac9c505f548fdbddd43023eb3 100644 (file)
@@ -3223,9 +3223,8 @@ static int network_init(void) {
 
   if (dispatch_thread_running == 0) {
     int status;
-    status = plugin_thread_create(&dispatch_thread_id, NULL /* no attributes */,
-                                  dispatch_thread, NULL /* no argument */,
-                                  "network disp");
+    status = plugin_thread_create(&dispatch_thread_id, dispatch_thread,
+                                  NULL /* no argument */, "network disp");
     if (status != 0) {
       ERROR("network: pthread_create failed: %s", STRERRNO);
     } else {
@@ -3235,9 +3234,8 @@ static int network_init(void) {
 
   if (receive_thread_running == 0) {
     int status;
-    status = plugin_thread_create(&receive_thread_id, NULL /* no attributes */,
-                                  receive_thread, NULL /* no argument */,
-                                  "network recv");
+    status = plugin_thread_create(&receive_thread_id, receive_thread,
+                                  NULL /* no argument */, "network recv");
     if (status != 0) {
       ERROR("network: pthread_create failed: %s", STRERRNO);
     } else {
index 61d226c4c91e7c03b61076dd84dae7775f033b80..68c0c08ed6e87978b332767b5666456a02fb9f45 100644 (file)
@@ -574,8 +574,7 @@ static int plugin_init(void) /* {{{ */
   if (collector_thread_running)
     return 0;
 
-  status = plugin_thread_create(&collector_thread_id,
-                                /* attrs = */ NULL, collector_thread,
+  status = plugin_thread_create(&collector_thread_id, collector_thread,
                                 /* args = */ NULL, "pinba collector");
   if (status != 0) {
     ERROR("pinba plugin: pthread_create(3) failed: %s", STRERRNO);
index 203d22302c1fd688c2e4ff218d35741838de10dc..b151464809060d5e56feccf6e94974b5c9a4ee20 100644 (file)
@@ -359,7 +359,7 @@ static int start_thread(void) /* {{{ */
 
   ping_thread_loop = 1;
   ping_thread_error = 0;
-  status = plugin_thread_create(&ping_thread_id, /* attr = */ NULL, ping_thread,
+  status = plugin_thread_create(&ping_thread_id, ping_thread,
                                 /* arg = */ (void *)0, "ping");
   if (status != 0) {
     ping_thread_loop = 0;
index ab000dbd00d331ef87952077a5e308f4b7198983..03d9081f3bad8d8611965c5dbb03ff8f3c1abec8 100644 (file)
@@ -1006,7 +1006,7 @@ static int start_netlink_thread(void) /* {{{ */
   procevent_netlink_thread_loop = 1;
   procevent_netlink_thread_error = 0;
 
-  status = plugin_thread_create(&procevent_netlink_thread_id, /* attr = */ NULL,
+  status = plugin_thread_create(&procevent_netlink_thread_id,
                                 procevent_netlink_thread,
                                 /* arg = */ (void *)0, "procevent");
   if (status != 0) {
@@ -1043,7 +1043,7 @@ static int start_dequeue_thread(void) /* {{{ */
   procevent_dequeue_thread_loop = 1;
 
   int status = plugin_thread_create(&procevent_dequeue_thread_id,
-                                    /* attr = */ NULL, procevent_dequeue_thread,
+                                    procevent_dequeue_thread,
                                     /* arg = */ (void *)0, "procevent");
   if (status != 0) {
     procevent_dequeue_thread_loop = 0;
index 70db6b6fc43a8fdd1905c4ba6eca7a64ba95e2ac..a248fdad5bd62054f4bd962c95b03c2b1ea702c6 100644 (file)
@@ -1170,7 +1170,7 @@ static int cpy_init(void) {
       ERROR("python: Unable to create pipe.");
       return 1;
     }
-    if (plugin_thread_create(&thread, NULL, cpy_interactive, pipefd + 1,
+    if (plugin_thread_create(&thread, cpy_interactive, pipefd + 1,
                              "python interpreter")) {
       ERROR("python: Error creating thread for interactive interpreter.");
     }
index bd5943c5ad0a3f1b710646f962941519398d2ebb..f188ac4ad008fdd735b4ed26172f8408b712b6b0 100644 (file)
@@ -1057,9 +1057,8 @@ static int rrd_init(void) {
 
   pthread_mutex_unlock(&cache_lock);
 
-  int status =
-      plugin_thread_create(&queue_thread, /* attr = */ NULL, rrd_queue_thread,
-                           /* args = */ NULL, "rrdtool queue");
+  int status = plugin_thread_create(&queue_thread, rrd_queue_thread,
+                                    /* args = */ NULL, "rrdtool queue");
   if (status != 0) {
     ERROR("rrdtool plugin: Cannot create queue-thread.");
     return -1;
index 07bd1c81d3a3a96bf45be5dc383128c2db6a444e..e4797b9ce286d2f48f81a0a1a4e9b98cf48a0e6e 100644 (file)
@@ -337,8 +337,8 @@ static int sigrok_init(void) {
     return -1;
   }
 
-  status = plugin_thread_create(&sr_thread, NULL, sigrok_read_thread, NULL,
-                                "sigrok read");
+  status =
+      plugin_thread_create(&sr_thread, sigrok_read_thread, NULL, "sigrok read");
   if (status != 0) {
     ERROR("sigrok plugin: Failed to create thread: %s.", STRERRNO);
     return -1;
index 7f9aa9f65460a77badf9cdca69a64048375c2fa9..03251dcf4db175e5dff29e094ddf0c1de68fee6f 100644 (file)
@@ -754,9 +754,9 @@ static int start_socket_thread(void) /* {{{ */
 
   DEBUG("sysevent plugin: starting socket thread");
 
-  int status = plugin_thread_create(&sysevent_socket_thread_id,
-                                    /* attr = */ NULL, sysevent_socket_thread,
-                                    /* arg = */ (void *)0, "sysevent");
+  int status =
+      plugin_thread_create(&sysevent_socket_thread_id, sysevent_socket_thread,
+                           /* arg = */ (void *)0, "sysevent");
   if (status != 0) {
     sysevent_socket_thread_loop = 0;
     ERROR("sysevent plugin: starting socket thread failed.");
@@ -780,9 +780,9 @@ static int start_dequeue_thread(void) /* {{{ */
 
   sysevent_dequeue_thread_loop = 1;
 
-  int status = plugin_thread_create(&sysevent_dequeue_thread_id,
-                                    /* attr = */ NULL, sysevent_dequeue_thread,
-                                    /* arg = */ (void *)0, "ssyevent");
+  int status =
+      plugin_thread_create(&sysevent_dequeue_thread_id, sysevent_dequeue_thread,
+                           /* arg = */ (void *)0, "ssyevent");
   if (status != 0) {
     sysevent_dequeue_thread_loop = 0;
     ERROR("sysevent plugin: Starting dequeue thread failed.");
index 6ff54997c5c8d88a3527576c981eb0e35d9002a7..f6799178aac96b3ee739f56f086eb37dbed1b191 100644 (file)
@@ -274,10 +274,6 @@ static void *us_server_thread(void __attribute__((unused)) * arg) {
   int status;
   int *remote_fd;
   pthread_t th;
-  pthread_attr_t th_attr;
-
-  pthread_attr_init(&th_attr);
-  pthread_attr_setdetachstate(&th_attr, PTHREAD_CREATE_DETACHED);
 
   if (us_open_socket() != 0)
     pthread_exit((void *)1);
@@ -293,7 +289,6 @@ static void *us_server_thread(void __attribute__((unused)) * arg) {
       ERROR("unixsock plugin: accept failed: %s", STRERRNO);
       close(sock_fd);
       sock_fd = -1;
-      pthread_attr_destroy(&th_attr);
       pthread_exit((void *)1);
     }
 
@@ -307,9 +302,11 @@ static void *us_server_thread(void __attribute__((unused)) * arg) {
 
     DEBUG("Spawning child to handle connection on fd #%i", *remote_fd);
 
-    status = plugin_thread_create(&th, &th_attr, us_handle_client,
-                                  (void *)remote_fd, "unixsock conn");
-    if (status != 0) {
+    status = plugin_thread_create(&th, us_handle_client, (void *)remote_fd,
+                                  "unixsock conn");
+    if (status == 0) {
+      pthread_detach(th);
+    } else {
       WARNING("unixsock plugin: pthread_create failed: %s", STRERRNO);
       close(*remote_fd);
       free(remote_fd);
@@ -319,7 +316,6 @@ static void *us_server_thread(void __attribute__((unused)) * arg) {
 
   close(sock_fd);
   sock_fd = -1;
-  pthread_attr_destroy(&th_attr);
 
   status = unlink((sock_file != NULL) ? sock_file : US_DEFAULT_PATH);
   if (status != 0) {
@@ -371,7 +367,7 @@ static int us_init(void) {
 
   loop = 1;
 
-  status = plugin_thread_create(&listen_thread, NULL, us_server_thread, NULL,
+  status = plugin_thread_create(&listen_thread, us_server_thread, NULL,
                                 "unixsock listen");
   if (status != 0) {
     ERROR("unixsock plugin: pthread_create failed: %s", STRERRNO);
index 52a590b164e579d88228e0b5b8ecd646541bf21a..e991a43528dae4a01d9ef273ffe2397ad6793504 100644 (file)
@@ -926,8 +926,8 @@ static int ovs_db_event_thread_init(ovs_db_t *pdb) {
   }
   /* start event thread */
   pthread_t tid;
-  if (plugin_thread_create(&tid, NULL, ovs_event_worker, pdb,
-                           "utils_ovs:event") != 0) {
+  if (plugin_thread_create(&tid, ovs_event_worker, pdb, "utils_ovs:event") !=
+      0) {
     pthread_mutex_unlock(&pdb->event_thread.mutex);
     pthread_mutex_destroy(&pdb->event_thread.mutex);
     pthread_cond_destroy(&pdb->event_thread.cond);
@@ -972,8 +972,7 @@ static int ovs_db_poll_thread_init(ovs_db_t *pdb) {
   /* start poll thread */
   pthread_t tid;
   pdb->poll_thread.state = OVS_DB_POLL_STATE_RUNNING;
-  if (plugin_thread_create(&tid, NULL, ovs_poll_worker, pdb,
-                           "utils_ovs:poll") != 0) {
+  if (plugin_thread_create(&tid, ovs_poll_worker, pdb, "utils_ovs:poll") != 0) {
     pthread_mutex_destroy(&pdb->poll_thread.mutex);
     return -1;
   }