[nginx] Introduced ngx_rwlock_downgrade().
Ruslan Ermilov
ru at nginx.com
Fri Jun 16 15:17:18 UTC 2017
details: http://hg.nginx.org/nginx/rev/d1816a2696de
branches:
changeset: 7038:d1816a2696de
user: Ruslan Ermilov <ru at nginx.com>
date: Fri Jun 16 18:15:58 2017 +0300
description:
Introduced ngx_rwlock_downgrade().
diffstat:
src/core/ngx_rwlock.c | 9 +++++++++
src/core/ngx_rwlock.h | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
diffs (30 lines):
diff -r 12efcdcb8a4b -r d1816a2696de src/core/ngx_rwlock.c
--- a/src/core/ngx_rwlock.c Fri Jun 16 18:15:53 2017 +0300
+++ b/src/core/ngx_rwlock.c Fri Jun 16 18:15:58 2017 +0300
@@ -109,6 +109,15 @@ ngx_rwlock_unlock(ngx_atomic_t *lock)
}
+void
+ngx_rwlock_downgrade(ngx_atomic_t *lock)
+{
+ if (*lock == NGX_RWLOCK_WLOCK) {
+ *lock = 1;
+ }
+}
+
+
#else
#if (NGX_HTTP_UPSTREAM_ZONE || NGX_STREAM_UPSTREAM_ZONE)
diff -r 12efcdcb8a4b -r d1816a2696de src/core/ngx_rwlock.h
--- a/src/core/ngx_rwlock.h Fri Jun 16 18:15:53 2017 +0300
+++ b/src/core/ngx_rwlock.h Fri Jun 16 18:15:58 2017 +0300
@@ -16,6 +16,7 @@
void ngx_rwlock_wlock(ngx_atomic_t *lock);
void ngx_rwlock_rlock(ngx_atomic_t *lock);
void ngx_rwlock_unlock(ngx_atomic_t *lock);
+void ngx_rwlock_downgrade(ngx_atomic_t *lock);
#endif /* _NGX_RWLOCK_H_INCLUDED_ */
More information about the nginx-devel
mailing list