From ec0affa97de870f3acd280afff728adccd48b2c8 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Tue, 7 Oct 2008 23:44:59 +0000 Subject: allow threads to be named. not posix compliant. --- ot_clean.c | 6 ++++++ ot_fullscrape.c | 6 ++++++ ot_livesync.c | 6 ++++++ ot_sync.c | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/ot_clean.c b/ot_clean.c index f8bb637..d991d54 100644 --- a/ot_clean.c +++ b/ot_clean.c @@ -8,6 +8,9 @@ #include #include #include +#ifdef WANT_THREAD_NAME_NP +#include +#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 ) { diff --git a/ot_fullscrape.c b/ot_fullscrape.c index abd8cee..cab619b 100644 --- a/ot_fullscrape.c +++ b/ot_fullscrape.c @@ -15,6 +15,9 @@ #ifdef WANT_COMPRESSION_GZIP #include #endif +#ifdef WANT_THREAD_NAME_NP +#include +#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( ) { diff --git a/ot_livesync.c b/ot_livesync.c index 92c947c..382f702 100644 --- a/ot_livesync.c +++ b/ot_livesync.c @@ -8,6 +8,9 @@ #include #include #include +#ifdef WANT_THREAD_NAME_NP +#include +#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() { diff --git a/ot_sync.c b/ot_sync.c index 4beb60d..c204c95 100644 --- a/ot_sync.c +++ b/ot_sync.c @@ -10,6 +10,9 @@ #include #include #include +#ifdef WANT_THREAD_NAME_NP +#include +#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( ) { -- cgit v1.2.3