diff options
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/unix/ngx_process_cycle.c | 18 | ||||
-rw-r--r-- | src/os/win32/ngx_process_cycle.c | 2 | ||||
-rw-r--r-- | src/os/win32/ngx_win32_config.h | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c index f2d392a91..090733adb 100644 --- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -65,10 +65,11 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) signo = 0; live = 0; - ngx_accept_mutex = mmap(NULL, sizeof(ngx_atomic_t), PROT_READ|PROT_WRITE, - MAP_ANON|MAP_SHARED, -1, 0); + ngx_accept_mutex_ptr = mmap(NULL, sizeof(ngx_atomic_t), + PROT_READ|PROT_WRITE, + MAP_ANON|MAP_SHARED, -1, 0); - if (ngx_accept_mutex == NULL) { + if (ngx_accept_mutex_ptr == NULL) { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, "mmap(MAP_ANON|MAP_SHARED) failed"); /* fatal */ @@ -375,12 +376,13 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) ngx_process = NGX_PROCESS_WORKER; ngx_last_process = 0; - if (ngx_accept_mutex) { - ngx_accept_token = 1; - } - ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + if (ccf->worker_processes > 1) { + ngx_accept_mutex = ngx_accept_mutex_ptr; + ngx_accept_mutex_held = 1; + } + if (ccf->group != (gid_t) NGX_CONF_UNSET) { if (setuid(ccf->group) == -1) { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, @@ -483,6 +485,8 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) ngx_close_listening_sockets(cycle); + ngx_accept_mutex = NULL; + for ( ;; ) { if (ngx_event_timer_rbtree == &ngx_event_timer_sentinel) { ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); diff --git a/src/os/win32/ngx_process_cycle.c b/src/os/win32/ngx_process_cycle.c index 929171055..1b8f18629 100644 --- a/src/os/win32/ngx_process_cycle.c +++ b/src/os/win32/ngx_process_cycle.c @@ -48,6 +48,6 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) for ( ;; ) { ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); - ngx_process_events(cycle->log); + ngx_process_events(cycle); } } diff --git a/src/os/win32/ngx_win32_config.h b/src/os/win32/ngx_win32_config.h index cab3321e5..cc3a06842 100644 --- a/src/os/win32/ngx_win32_config.h +++ b/src/os/win32/ngx_win32_config.h @@ -31,6 +31,7 @@ /* disable some "-W4" level warnings */ #pragma warning(disable:4054) +#pragma warning(disable:4054) #pragma warning(disable:4055) /* unreferenced formal parameter */ #pragma warning(disable:4100) @@ -43,6 +44,8 @@ #ifdef __WATCOMC__ +/* unreachable code */ +#pragma disable_message(201) /* disable "Symbol 'ngx_rbtree_min' has been defined, but not referenced" */ #pragma disable_message(202) #endif @@ -86,6 +89,7 @@ typedef long time_t; typedef __int64 off_t; typedef uint32_t in_addr_t; typedef int sig_atomic_t; +typedef uint32_t ngx_atomic_t; #define OFF_T_FMT "%I64d" |