summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorBill Stoddard <stoddard@apache.org>2002-05-24 18:56:39 +0200
committerBill Stoddard <stoddard@apache.org>2002-05-24 18:56:39 +0200
commit7e3edc569b5d4ce41b31d5e92e735cc4949d529c (patch)
treeec02e4521fcc7316a298f8af83e68c1db0c02ff4 /server
parentExporting a missing API for NetWare (diff)
downloadapache2-7e3edc569b5d4ce41b31d5e92e735cc4949d529c.tar.xz
apache2-7e3edc569b5d4ce41b31d5e92e735cc4949d529c.zip
Win32: Use atomic increment/decrement on counters touched by multiple threads.
I intentionally did not use atomic operators on the Win9* code paths. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95267 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/mpm/winnt/mpm_winnt.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c
index f9c7614cef..87b125b554 100644
--- a/server/mpm/winnt/mpm_winnt.c
+++ b/server/mpm/winnt/mpm_winnt.c
@@ -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 @@ AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void)
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 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context)
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 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context)
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;
}