libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Naming the libmicrohttpd threads


From: Дилян Палаузов
Subject: [libmicrohttpd] Naming the libmicrohttpd threads
Date: Sat, 06 Jul 2013 13:21:52 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

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

[Prev in Thread] Current Thread [Next in Thread]