static void* process_thread_job(void* arg) { tinfo_t* tinfo = (tinfo_t*) arg; pthread_t parent_tid; #ifdef DEBUG unsigned int tnum = tinfo->thread_num; xlog(LOG_DEBUG, "Starting thread %d\n", tnum); #endif parent_tid = tinfo->main_tid; /* treat request */ proxenet_process_http_request(tinfo->sock); /* purge thread */ proxenet_xfree(arg); /* signal main thread (parent) to clean up */ if (pthread_kill(parent_tid, SIGCHLD) < 0){ xlog(LOG_ERROR, "Sending SIGCHLD failed: %s\n", strerror(errno)); } #ifdef DEBUG xlog(LOG_DEBUG, "Ending thread %d\n", tnum); #endif pthread_exit(0); }
static void* process_thread_job(void* arg) { tinfo_t* tinfo = (tinfo_t*) arg; pthread_t parent_tid; active_threads_bitmask |= 1 << tinfo->thread_num; parent_tid = tinfo->main_tid; /* treat request */ proxenet_process_http_request(tinfo->sock); /* purge thread */ proxenet_xfree(arg); /* signal main thread (parent) to clean up */ if (pthread_kill(parent_tid, SIGCHLD) < 0){ xlog(LOG_ERROR, "Sending SIGCHLD failed: %s\n", strerror(errno)); } pthread_exit(NULL); }