diff options
author | Ben Magistro <koncept1@gmail.com> | 2022-04-17 09:45:02 -0400 |
---|---|---|
committer | Ben Magistro <koncept1@gmail.com> | 2022-04-20 21:30:13 -0400 |
commit | bf8c01bfcd015d43cfbcb893e48c6a83a95c91ec (patch) | |
tree | d4871f553a40aaed8cf98165f1e4f07584cfb95e /app/nginx/src/core/ngx_rwlock.c | |
parent | 862937c477a3d90798a5e4c4e84fc7c79aae52fe (diff) |
Drop nginxdev-mitm-proxy
Nginx is not part of the core library being developed and needs to
be moved to its own repository to allow it to be more easily
maintained.
Signed-off-by: Ben Magistro <koncept1@gmail.com>
Change-Id: I5639e84ba0564ccd49ffcffa7ec9fcd57827bd6d
Diffstat (limited to 'app/nginx/src/core/ngx_rwlock.c')
-rw-r--r-- | app/nginx/src/core/ngx_rwlock.c | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/app/nginx/src/core/ngx_rwlock.c b/app/nginx/src/core/ngx_rwlock.c deleted file mode 100644 index 905de78..0000000 --- a/app/nginx/src/core/ngx_rwlock.c +++ /dev/null @@ -1,120 +0,0 @@ - -/* - * Copyright (C) Ruslan Ermilov - * Copyright (C) Nginx, Inc. - */ - - -#include <ngx_config.h> -#include <ngx_core.h> - - -#if (NGX_HAVE_ATOMIC_OPS) - - -#define NGX_RWLOCK_SPIN 2048 -#define NGX_RWLOCK_WLOCK ((ngx_atomic_uint_t) -1) - - -void -ngx_rwlock_wlock(ngx_atomic_t *lock) -{ - ngx_uint_t i, n; - - for ( ;; ) { - - if (*lock == 0 && ngx_atomic_cmp_set(lock, 0, NGX_RWLOCK_WLOCK)) { - return; - } - - if (ngx_ncpu > 1) { - - for (n = 1; n < NGX_RWLOCK_SPIN; n <<= 1) { - - for (i = 0; i < n; i++) { - ngx_cpu_pause(); - } - - if (*lock == 0 - && ngx_atomic_cmp_set(lock, 0, NGX_RWLOCK_WLOCK)) - { - return; - } - } - } - - ngx_sched_yield(); - } -} - - -void -ngx_rwlock_rlock(ngx_atomic_t *lock) -{ - ngx_uint_t i, n; - ngx_atomic_uint_t readers; - - for ( ;; ) { - readers = *lock; - - if (readers != NGX_RWLOCK_WLOCK - && ngx_atomic_cmp_set(lock, readers, readers + 1)) - { - return; - } - - if (ngx_ncpu > 1) { - - for (n = 1; n < NGX_RWLOCK_SPIN; n <<= 1) { - - for (i = 0; i < n; i++) { - ngx_cpu_pause(); - } - - readers = *lock; - - if (readers != NGX_RWLOCK_WLOCK - && ngx_atomic_cmp_set(lock, readers, readers + 1)) - { - return; - } - } - } - - ngx_sched_yield(); - } -} - - -void -ngx_rwlock_unlock(ngx_atomic_t *lock) -{ - ngx_atomic_uint_t readers; - - readers = *lock; - - if (readers == NGX_RWLOCK_WLOCK) { - *lock = 0; - return; - } - - for ( ;; ) { - - if (ngx_atomic_cmp_set(lock, readers, readers - 1)) { - return; - } - - readers = *lock; - } -} - - -#else - -#if (NGX_HTTP_UPSTREAM_ZONE || NGX_STREAM_UPSTREAM_ZONE) - -#error ngx_atomic_cmp_set() is not defined! - -#endif - -#endif |