]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
allow threads to be named. not posix compliant.
authorerdgeist <>
Tue, 7 Oct 2008 23:44:59 +0000 (23:44 +0000)
committererdgeist <>
Tue, 7 Oct 2008 23:44:59 +0000 (23:44 +0000)
ot_clean.c
ot_fullscrape.c
ot_livesync.c
ot_sync.c

index f8bb6375b1d7eed734f1c41fec8621f211ef09ff..d991d54cc677df0d28e20dc97b5b690e195917d0 100644 (file)
@@ -8,6 +8,9 @@
 #include <string.h>
 #include <pthread.h>
 #include <sys/uio.h>
+#ifdef WANT_THREAD_NAME_NP
+#include <pthread_np.h>
+#endif
 
 /* Libowfat */
 #include "byte.h"
@@ -126,6 +129,9 @@ void clean_all_torrents( ) {
 static pthread_t thread_id;
 void clean_init( void ) {
   pthread_create( &thread_id, NULL, clean_worker, NULL );
+#ifdef WANT_THREAD_NAME_NP
+  pthread_set_name_np( thread_id, "opentracker (cleanup)");
+#endif
 }
 
 void clean_deinit( void ) {
index abd8ceec5ad85060e193badc620ed843d6fab374..cab619b0611fff924daeaa29ecc5fb5450af89a3 100644 (file)
@@ -15,6 +15,9 @@
 #ifdef WANT_COMPRESSION_GZIP
 #include <zlib.h>
 #endif
+#ifdef WANT_THREAD_NAME_NP
+#include <pthread_np.h>
+#endif
 
 /* Libowfat */
 #include "byte.h"
@@ -73,6 +76,9 @@ static void * fullscrape_worker( void * args ) {
 static pthread_t thread_id;
 void fullscrape_init( ) {
   pthread_create( &thread_id, NULL, fullscrape_worker, NULL );
+#ifdef WANT_THREAD_NAME_NP
+  pthread_set_name_np( thread_id, "opentracker (fullscrape)");
+#endif  
 }
 
 void fullscrape_deinit( ) {
index 92c947c435625afd3fcfa1a29ddecdbfafc61072..382f702016260336aec080b6bc31e218420d412f 100644 (file)
@@ -8,6 +8,9 @@
 #include <sys/uio.h>
 #include <string.h>
 #include <pthread.h>
+#ifdef WANT_THREAD_NAME_NP
+#include <pthread_np.h>
+#endif
 
 /* Libowfat */
 #include "socket.h"
@@ -53,6 +56,9 @@ void livesync_init( ) {
   livesync_lastpacket_time = g_now;
 
   pthread_create( &thread_id, NULL, livesync_worker, NULL );
+#ifdef WANT_THREAD_NAME_NP
+  pthread_set_name_np( thread_id, "opentracker (livesync)");
+#endif  
 }
        
 void livesync_deinit() {
index 4beb60dfab7ad2c9e7ea0e86012bf20cc27f98de..c204c9556524b333cff137c84400e20e6fb2d9ca 100644 (file)
--- a/ot_sync.c
+++ b/ot_sync.c
@@ -10,6 +10,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <pthread.h>
+#ifdef WANT_THREAD_NAME_NP
+#include <pthread_np.h>
+#endif
 
 /* Libowfat */
 #include "scan.h"
@@ -151,6 +154,9 @@ static void * sync_worker( void * args) {
 static pthread_t thread_id;
 void sync_init( ) {
   pthread_create( &thread_id, NULL, sync_worker, NULL );
+#ifdef WANT_THREAD_NAME_NP
+  pthread_set_name_np( thread_id, "opentracker (batchsync)");
+#endif  
 }
 
 void sync_deinit( ) {