예제 #1
0
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);
}
예제 #2
0
파일: core.c 프로젝트: steeve85/proxenet
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);
}