Mercurial > hg > nginx
comparison src/core/ngx_rwlock.c @ 8977:7c2adf237091 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 25 Jan 2022 23:42:48 +0300 |
parents | 7752d8523066 |
children |
comparison
equal
deleted
inserted
replaced
8976:4646a981111f | 8977:7c2adf237091 |
---|---|
87 | 87 |
88 | 88 |
89 void | 89 void |
90 ngx_rwlock_unlock(ngx_atomic_t *lock) | 90 ngx_rwlock_unlock(ngx_atomic_t *lock) |
91 { | 91 { |
92 ngx_atomic_uint_t readers; | 92 if (*lock == NGX_RWLOCK_WLOCK) { |
93 | |
94 readers = *lock; | |
95 | |
96 if (readers == NGX_RWLOCK_WLOCK) { | |
97 (void) ngx_atomic_cmp_set(lock, NGX_RWLOCK_WLOCK, 0); | 93 (void) ngx_atomic_cmp_set(lock, NGX_RWLOCK_WLOCK, 0); |
98 return; | 94 } else { |
99 } | 95 (void) ngx_atomic_fetch_add(lock, -1); |
100 | |
101 for ( ;; ) { | |
102 | |
103 if (ngx_atomic_cmp_set(lock, readers, readers - 1)) { | |
104 return; | |
105 } | |
106 | |
107 readers = *lock; | |
108 } | 96 } |
109 } | 97 } |
110 | 98 |
111 | 99 |
112 void | 100 void |