summaryrefslogtreecommitdiff
path: root/src/core/ngx_shmtx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_shmtx.c')
-rw-r--r--src/core/ngx_shmtx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/ngx_shmtx.c b/src/core/ngx_shmtx.c
index a62999f33..6230dc060 100644
--- a/src/core/ngx_shmtx.c
+++ b/src/core/ngx_shmtx.c
@@ -101,6 +101,7 @@ ngx_shmtx_lock(ngx_shmtx_t *mtx)
(void) ngx_atomic_fetch_add(mtx->wait, 1);
if (*mtx->lock == 0 && ngx_atomic_cmp_set(mtx->lock, 0, ngx_pid)) {
+ (void) ngx_atomic_fetch_add(mtx->wait, -1);
return;
}
@@ -174,7 +175,7 @@ ngx_shmtx_wakeup(ngx_shmtx_t *mtx)
wait = *mtx->wait;
- if (wait == 0) {
+ if ((ngx_atomic_int_t) wait <= 0) {
return;
}