[nginx] Added memory barrier semantics to ngx_rwlock_unlock().

Ruslan Ermilov ru at nginx.com
Fri Jun 16 15:17:15 UTC 2017


details:   http://hg.nginx.org/nginx/rev/12efcdcb8a4b
branches:  
changeset: 7037:12efcdcb8a4b
user:      Ruslan Ermilov <ru at nginx.com>
date:      Fri Jun 16 18:15:53 2017 +0300
description:
Added memory barrier semantics to ngx_rwlock_unlock().

diffstat:

 src/core/ngx_rwlock.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 8666da1ecf33 -r 12efcdcb8a4b src/core/ngx_rwlock.c
--- a/src/core/ngx_rwlock.c	Fri Mar 24 03:37:34 2017 -0700
+++ b/src/core/ngx_rwlock.c	Fri Jun 16 18:15:53 2017 +0300
@@ -94,7 +94,7 @@ ngx_rwlock_unlock(ngx_atomic_t *lock)
     readers = *lock;
 
     if (readers == NGX_RWLOCK_WLOCK) {
-        *lock = 0;
+        (void) ngx_atomic_cmp_set(lock, NGX_RWLOCK_WLOCK, 0);
         return;
     }
 


More information about the nginx-devel mailing list