httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm_winnt.c
Date Fri, 24 May 2002 16:56:40 GMT
stoddard    02/05/24 09:56:39

  Modified:    server/mpm/winnt mpm_winnt.c
  Log:
  Win32: Use atomic increment/decrement on counters touched by multiple threads.
  I intentionally did not use atomic operators on the Win9* code paths.
  
  Revision  Changes    Path
  1.275     +7 -7      httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.274
  retrieving revision 1.275
  diff -u -r1.274 -r1.275
  --- mpm_winnt.c	18 May 2002 21:43:24 -0000	1.274
  +++ mpm_winnt.c	24 May 2002 16:56:39 -0000	1.275
  @@ -76,6 +76,7 @@
   #include "mpm_winnt.h"
   #include "mpm_common.h"
   #include <malloc.h>
  +#include "apr_atomic.h"
   
   /* Limit on the threads per process.  Clients will be locked out if more than
    * this  * HARD_SERVER_LIMIT are needed.
  @@ -281,7 +282,7 @@
   
           context->accept_socket = INVALID_SOCKET;
           context->ba = apr_bucket_alloc_create(pchild);
  -        num_completion_contexts++;
  +        apr_atomic_inc(&num_completion_contexts);
       }
   
       return context;
  @@ -1068,10 +1069,10 @@
   
       mpm_recycle_completion_context(context);
   
  -    g_blocked_threads++;        
  +    apr_atomic_inc(&g_blocked_threads);
       while (1) {
           if (workers_may_exit) {
  -            g_blocked_threads--;
  +            apr_atomic_dec(&g_blocked_threads);
               return NULL;
           }
           rc = GetQueuedCompletionStatus(ThreadDispatchIOCP, &BytesRead, &CompKey,
  @@ -1088,16 +1089,15 @@
               context = CONTAINING_RECORD(pol, COMP_CONTEXT, Overlapped);
               break;
           case IOCP_SHUTDOWN:
  -            g_blocked_threads--;
  +            apr_atomic_dec(&g_blocked_threads);
               return NULL;
           default:
  -            g_blocked_threads--;
  +            apr_atomic_dec(&g_blocked_threads);
               return NULL;
           }
           break;
       }
  -
  -    g_blocked_threads--;    
  +    apr_atomic_dec(&g_blocked_threads);
   
       return context;
   }
  
  
  

Mime
View raw message