diff options
author | erdgeist <> | 2008-10-07 23:44:59 +0000 |
---|---|---|
committer | erdgeist <> | 2008-10-07 23:44:59 +0000 |
commit | ec0affa97de870f3acd280afff728adccd48b2c8 (patch) | |
tree | 815bb871f6ac62a7ada26217b4a8d649ea8e57de | |
parent | 1c3c5d57dafc44c582a6d29a7db04cfeba2464da (diff) |
allow threads to be named. not posix compliant.
-rw-r--r-- | ot_clean.c | 6 | ||||
-rw-r--r-- | ot_fullscrape.c | 6 | ||||
-rw-r--r-- | ot_livesync.c | 6 | ||||
-rw-r--r-- | ot_sync.c | 6 |
4 files changed, 24 insertions, 0 deletions
@@ -8,6 +8,9 @@ | |||
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <pthread.h> | 9 | #include <pthread.h> |
10 | #include <sys/uio.h> | 10 | #include <sys/uio.h> |
11 | #ifdef WANT_THREAD_NAME_NP | ||
12 | #include <pthread_np.h> | ||
13 | #endif | ||
11 | 14 | ||
12 | /* Libowfat */ | 15 | /* Libowfat */ |
13 | #include "byte.h" | 16 | #include "byte.h" |
@@ -126,6 +129,9 @@ void clean_all_torrents( ) { | |||
126 | static pthread_t thread_id; | 129 | static pthread_t thread_id; |
127 | void clean_init( void ) { | 130 | void clean_init( void ) { |
128 | pthread_create( &thread_id, NULL, clean_worker, NULL ); | 131 | pthread_create( &thread_id, NULL, clean_worker, NULL ); |
132 | #ifdef WANT_THREAD_NAME_NP | ||
133 | pthread_set_name_np( thread_id, "opentracker (cleanup)"); | ||
134 | #endif | ||
129 | } | 135 | } |
130 | 136 | ||
131 | void clean_deinit( void ) { | 137 | 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 @@ | |||
15 | #ifdef WANT_COMPRESSION_GZIP | 15 | #ifdef WANT_COMPRESSION_GZIP |
16 | #include <zlib.h> | 16 | #include <zlib.h> |
17 | #endif | 17 | #endif |
18 | #ifdef WANT_THREAD_NAME_NP | ||
19 | #include <pthread_np.h> | ||
20 | #endif | ||
18 | 21 | ||
19 | /* Libowfat */ | 22 | /* Libowfat */ |
20 | #include "byte.h" | 23 | #include "byte.h" |
@@ -73,6 +76,9 @@ static void * fullscrape_worker( void * args ) { | |||
73 | static pthread_t thread_id; | 76 | static pthread_t thread_id; |
74 | void fullscrape_init( ) { | 77 | void fullscrape_init( ) { |
75 | pthread_create( &thread_id, NULL, fullscrape_worker, NULL ); | 78 | pthread_create( &thread_id, NULL, fullscrape_worker, NULL ); |
79 | #ifdef WANT_THREAD_NAME_NP | ||
80 | pthread_set_name_np( thread_id, "opentracker (fullscrape)"); | ||
81 | #endif | ||
76 | } | 82 | } |
77 | 83 | ||
78 | void fullscrape_deinit( ) { | 84 | 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 @@ | |||
8 | #include <sys/uio.h> | 8 | #include <sys/uio.h> |
9 | #include <string.h> | 9 | #include <string.h> |
10 | #include <pthread.h> | 10 | #include <pthread.h> |
11 | #ifdef WANT_THREAD_NAME_NP | ||
12 | #include <pthread_np.h> | ||
13 | #endif | ||
11 | 14 | ||
12 | /* Libowfat */ | 15 | /* Libowfat */ |
13 | #include "socket.h" | 16 | #include "socket.h" |
@@ -53,6 +56,9 @@ void livesync_init( ) { | |||
53 | livesync_lastpacket_time = g_now; | 56 | livesync_lastpacket_time = g_now; |
54 | 57 | ||
55 | pthread_create( &thread_id, NULL, livesync_worker, NULL ); | 58 | pthread_create( &thread_id, NULL, livesync_worker, NULL ); |
59 | #ifdef WANT_THREAD_NAME_NP | ||
60 | pthread_set_name_np( thread_id, "opentracker (livesync)"); | ||
61 | #endif | ||
56 | } | 62 | } |
57 | 63 | ||
58 | void livesync_deinit() { | 64 | void livesync_deinit() { |
@@ -10,6 +10,9 @@ | |||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <pthread.h> | 12 | #include <pthread.h> |
13 | #ifdef WANT_THREAD_NAME_NP | ||
14 | #include <pthread_np.h> | ||
15 | #endif | ||
13 | 16 | ||
14 | /* Libowfat */ | 17 | /* Libowfat */ |
15 | #include "scan.h" | 18 | #include "scan.h" |
@@ -151,6 +154,9 @@ static void * sync_worker( void * args) { | |||
151 | static pthread_t thread_id; | 154 | static pthread_t thread_id; |
152 | void sync_init( ) { | 155 | void sync_init( ) { |
153 | pthread_create( &thread_id, NULL, sync_worker, NULL ); | 156 | pthread_create( &thread_id, NULL, sync_worker, NULL ); |
157 | #ifdef WANT_THREAD_NAME_NP | ||
158 | pthread_set_name_np( thread_id, "opentracker (batchsync)"); | ||
159 | #endif | ||
154 | } | 160 | } |
155 | 161 | ||
156 | void sync_deinit( ) { | 162 | void sync_deinit( ) { |