httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/worker worker.c
Date Thu, 27 Dec 2001 23:40:56 GMT
aaron       01/12/27 15:40:55

  Modified:    server/mpm/worker worker.c
  Log:
  Clean up the error checking a little. Make sure we're comparing against
  APR_SUCCESS instead of just non-zero. Add some new error checking/reporting.
  
  Revision  Changes    Path
  1.56      +23 -9     httpd-2.0/server/mpm/worker/worker.c
  
  Index: worker.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- worker.c	2001/12/27 17:06:40	1.55
  +++ worker.c	2001/12/27 23:40:55	1.56
  @@ -823,7 +823,17 @@
       my_info->pid = my_child_num;
       my_info->tid = i;
       my_info->sd = 0;
  -    apr_thread_create(&listener, thread_attr, listener_thread, my_info, pchild);
  +    rv = apr_thread_create(&listener, thread_attr, listener_thread,
  +                           my_info, pchild);
  +    if (rv != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf,
  +                     "apr_thread_create: unable to create worker thread");
  +        /* In case system resources are maxxed out, we don't want
  +         * Apache running away with the CPU trying to fork over and
  +         * over and over again if we exit. */
  +        sleep(10);
  +        clean_child_exit(APEXIT_CHILDFATAL);
  +    }
       while (1) {
           /* ap_threads_per_child does not include the listener thread */
           for (i = 0; i < ap_threads_per_child; i++) {
  @@ -833,7 +843,7 @@
                   continue;
               }
   
  -               my_info = (proc_info *)malloc(sizeof(proc_info));
  +            my_info = (proc_info *)malloc(sizeof(proc_info));
               if (my_info == NULL) {
                   ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
                                "malloc: out of memory");
  @@ -843,15 +853,17 @@
               my_info->tid = i;
               my_info->sd = 0;
           
  -              /* We are creating threads right now */
  -            ap_update_child_status_from_indexes(my_child_num, i, SERVER_STARTING, NULL);
  +            /* We are creating threads right now */
  +            ap_update_child_status_from_indexes(my_child_num, i,
  +                                                SERVER_STARTING, NULL);
               /* We let each thread update its own scoreboard entry.  This is
                * done because it lets us deal with tid better.
                */
  -            if ((rv = apr_thread_create(&threads[i], thread_attr, 
  -                                        worker_thread, my_info, pchild))) {
  +            rv = apr_thread_create(&threads[i], thread_attr, 
  +                                   worker_thread, my_info, pchild);
  +            if (rv != APR_SUCCESS) {
                   ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf,
  -                           "apr_thread_create: unable to create worker thread");
  +                    "apr_thread_create: unable to create worker thread");
                   /* In case system resources are maxxed out, we don't want
                      Apache running away with the CPU trying to fork over and
                      over and over again if we exit. */
  @@ -954,8 +966,10 @@
       ts->child_num_arg = child_num_arg;
       ts->threadattr = thread_attr;
   
  -    if ((rv = apr_thread_create(&start_thread_id, thread_attr, start_threads, 
  -                                ts, pchild))) {
  +    
  +    rv = apr_thread_create(&start_thread_id, thread_attr, start_threads,
  +                           ts, pchild);
  +    if (rv != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf,
                        "apr_thread_create: unable to create worker thread");
           /* In case system resources are maxxed out, we don't want
  
  
  

Mime
View raw message