Hello,

as of libc 2.12, a process can name its threads with the pthread_setname_np() [http://man7.org/linux/man-pages/man3/pthread_setname_np.3.html] function and see later with programs like htop the resources used by the named thread.

The patch below (the line is added just after pthread_create in daemon.c, whatever the line number is), names all threads, created by libmicrohttpd, as "libmicrohttpd".

I would appreciate, if this change gets incorporated.

Kind regards
  Дилян


----------------------- patch -----------------------

diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -843,6 +843,9 @@ create_thread (pthread_t * thread,
     }
   ret = pthread_create (thread, pattr,
                        start_routine, arg);
+#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)
+  pthread_setname_np (*thread, "libmicrohttpd");
+#endif
   if (0 != daemon->thread_stack_size)
     pthread_attr_destroy (&attr);
   return ret;

Reply via email to