diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-02-26 17:10:01 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-02-26 17:10:01 +0000 |
commit | 898446c8bacb5b0e1c223dfec4643ebee8d07f8e (patch) | |
tree | 01470b0ba4a9419412ed82fd4a5f6f746a4819d9 /src/os/unix | |
parent | f2334416e7485ff1c260a46ba47aeadffeff923a (diff) | |
download | nginx-898446c8bacb5b0e1c223dfec4643ebee8d07f8e.tar.gz nginx-898446c8bacb5b0e1c223dfec4643ebee8d07f8e.zip |
nginx-0.0.2-2004-02-26-20:10:01 import
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/ngx_freebsd_rfork_thread.c | 12 | ||||
-rw-r--r-- | src/os/unix/ngx_thread.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/os/unix/ngx_freebsd_rfork_thread.c b/src/os/unix/ngx_freebsd_rfork_thread.c index 4ea8b4c6c..dd18168a2 100644 --- a/src/os/unix/ngx_freebsd_rfork_thread.c +++ b/src/os/unix/ngx_freebsd_rfork_thread.c @@ -21,6 +21,8 @@ */ +ngx_int_t ngx_threaded; + static inline int ngx_gettid(); @@ -204,6 +206,8 @@ ngx_int_t ngx_init_threads(int n, size_t size, ngx_cycle_t *cycle) /* allow the spinlock in libc malloc() */ __isthreaded = 1; + ngx_threaded = 1; + return NGX_OK; } @@ -315,6 +319,10 @@ ngx_int_t ngx_mutex_do_lock(ngx_mutex_t *m, ngx_int_t try) ngx_uint_t tries; struct sembuf op; + if (!ngx_threaded) { + return NGX_OK; + } + #if (NGX_DEBUG) if (try) { ngx_log_debug2(NGX_LOG_DEBUG_CORE, m->log, 0, @@ -438,6 +446,10 @@ ngx_int_t ngx_mutex_unlock(ngx_mutex_t *m) uint32_t lock, new, old; struct sembuf op; + if (!ngx_threaded) { + return NGX_OK; + } + old = m->lock; if (!(old & NGX_MUTEX_LOCK_BUSY)) { diff --git a/src/os/unix/ngx_thread.h b/src/os/unix/ngx_thread.h index 3ecc1e62a..3961f328f 100644 --- a/src/os/unix/ngx_thread.h +++ b/src/os/unix/ngx_thread.h @@ -60,6 +60,9 @@ ngx_int_t ngx_mutex_do_lock(ngx_mutex_t *m, ngx_int_t try); ngx_int_t ngx_mutex_unlock(ngx_mutex_t *m); +extern ngx_int_t ngx_threaded; + + #else /* !NGX_THREADS */ #define ngx_log_tid 0 |