diff options
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 |