manoj 99/05/24 13:33:35
Modified: pthreads/src/main http_main.c
Log:
Since pthread_join isn't used anymore in the server, create all of our
threads in detached state.
Revision Changes Path
1.85 +5 -1 apache-apr/pthreads/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -u -r1.84 -r1.85
--- http_main.c 1999/05/24 06:53:34 1.84
+++ http_main.c 1999/05/24 20:33:32 1.85
@@ -1894,6 +1894,7 @@
sigset_t sig_mask;
int signal_received;
pthread_t thread;
+ pthread_attr_t thread_attr;
int i;
int my_child_num = child_num_arg;
proc_info *my_info = NULL;
@@ -1929,6 +1930,8 @@
worker_thread_count = 0;
pthread_mutex_init(&worker_thread_count_mutex, NULL);
+ pthread_attr_init(&thread_attr);
+ pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
for (i=0; i < ap_threads_per_child; i++) {
my_info = NULL;
@@ -1942,7 +1945,7 @@
/* We are creating threads right now */
(void) ap_update_child_status(my_child_num, i, SERVER_STARTING,
(request_rec *) NULL);
- if (pthread_create(&thread, NULL, worker_thread, my_info)) {
+ if (pthread_create(&thread, &thread_attr, worker_thread, my_info)) {
ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
"pthread_create: unable to create worker thread");
/*
@@ -1959,6 +1962,7 @@
*/
}
+ pthread_attr_destroy(&thread_attr);
start_accepting_connections(my_child_num);
/* This thread will be the one responsible for handling signals */