You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bn...@apache.org on 2002/06/01 00:16:04 UTC
cvs commit: httpd-2.0/server/mpm/netware mpm_netware.c
bnicholes 2002/05/31 15:16:04
Modified: server/mpm/netware mpm_netware.c
Log:
Switched to using atomic operations for tracking the active threads rather
than having to lock and unlock a mutex.
Revision Changes Path
1.53 +3 -9 httpd-2.0/server/mpm/netware/mpm_netware.c
Index: mpm_netware.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm_netware.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- mpm_netware.c 30 May 2002 00:21:27 -0000 1.52
+++ mpm_netware.c 31 May 2002 22:16:04 -0000 1.53
@@ -179,8 +179,7 @@
static apr_thread_mutex_t *accept_mutex = NULL;
/* Keep track of the number of worker threads currently active */
-static int worker_thread_count;
-static apr_thread_mutex_t *worker_thread_count_mutex;
+static unsigned long worker_thread_count;
static int request_count;
/* Structure used to register/deregister a console handler with the OS */
@@ -210,9 +209,7 @@
apr_bucket_alloc_destroy(bucket_alloc);
apr_pool_destroy(ptrans);
- apr_thread_mutex_lock(worker_thread_count_mutex);
- worker_thread_count--;
- apr_thread_mutex_unlock(worker_thread_count_mutex);
+ atomic_dec (&worker_thread_count);
if (worker_num >=0)
ap_update_child_status_from_indexes(0, worker_num, WORKER_DEAD,
(request_rec *) NULL);
@@ -382,9 +379,7 @@
bucket_alloc = apr_bucket_alloc_create(pmain);
- apr_thread_mutex_lock(worker_thread_count_mutex);
- worker_thread_count++;
- apr_thread_mutex_unlock(worker_thread_count_mutex);
+ atomic_inc (&worker_thread_count);
ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY,
(request_rec *) NULL);
@@ -899,7 +894,6 @@
restart_pending = shutdown_pending = 0;
worker_thread_count = 0;
- apr_thread_mutex_create(&worker_thread_count_mutex, APR_THREAD_MUTEX_DEFAULT, pconf);
apr_thread_mutex_create(&accept_mutex, APR_THREAD_MUTEX_DEFAULT, pconf);
if (!is_graceful) {