From 91ecc8f43c42c677cd7b2230a68f19b64b649ba5 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 23 Nov 2011 13:55:38 +0000 Subject: Added shmtx interface to forcibly unlock mutexes. It is currently used from master process on abnormal worker termination to unlock accept mutex (unlocking of accept mutex was broken in 1.0.2). It is expected to be used in the future to unlock other mutexes as well. Shared mutex code was rewritten to make this possible in a safe way, i.e. with a check if lock was actually held by the exited process. We again use pid to lock mutex, and use separate atomic variable for a count of processes waiting in sem_wait(). --- src/os/unix/ngx_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/os/unix/ngx_process.c') diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c index 08069c4b6..cbdae8be1 100644 --- a/src/os/unix/ngx_process.c +++ b/src/os/unix/ngx_process.c @@ -504,7 +504,7 @@ ngx_process_get_status(void) * held it */ - ngx_atomic_cmp_set(ngx_accept_mutex_ptr, pid, 0); + ngx_shmtx_force_unlock(&ngx_accept_mutex, pid); } -- cgit v1.2.3