1
0
mirror of git://erdgeist.org/opentracker synced 2025-01-14 08:50:10 +00:00

allow threads to be named. not posix compliant.

This commit is contained in:
erdgeist 2008-10-07 23:44:59 +00:00
parent 1c3c5d57da
commit ec0affa97d
4 changed files with 24 additions and 0 deletions

View 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 ) {

View 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( ) {

View 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() {

View File

@ -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( ) {