diff options
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/ngx_event.c | 17 | ||||
-rw-r--r-- | src/event/ngx_event_busy_lock.c | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c index 672eac2ba..f3b19a790 100644 --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -414,11 +414,12 @@ static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle) { void ***cf; + u_char *shared; + size_t size; ngx_event_conf_t *ecf; ngx_core_conf_t *ccf; + ngx_shm_t shm; #if !(NGX_WIN32) - char *shared; - size_t size; ngx_int_t limit; struct rlimit rlmt; #endif @@ -461,6 +462,8 @@ ngx_event_module_init(ngx_cycle_t *cycle) } } +#endif /* !(NGX_WIN32) */ + if (ccf->master == 0 || ngx_accept_mutex_ptr) { return NGX_OK; @@ -483,11 +486,15 @@ ngx_event_module_init(ngx_cycle_t *cycle) #endif - shared = ngx_create_shared_memory(size, cycle->log); - if (shared == NULL) { + shm.size = size; + shm.log = cycle->log; + + if (ngx_shm_alloc(&shm) != NGX_OK) { return NGX_ERROR; } + shared = shm.addr; + ngx_accept_mutex_ptr = (ngx_atomic_t *) shared; ngx_connection_counter = (ngx_atomic_t *) (shared + 1 * 128); @@ -508,8 +515,6 @@ ngx_event_module_init(ngx_cycle_t *cycle) "counter: %p, %d", ngx_connection_counter, *ngx_connection_counter); -#endif /* !(NGX_WIN32) */ - return NGX_OK; } diff --git a/src/event/ngx_event_busy_lock.c b/src/event/ngx_event_busy_lock.c index 1b09ad96c..2d0bad571 100644 --- a/src/event/ngx_event_busy_lock.c +++ b/src/event/ngx_event_busy_lock.c @@ -20,7 +20,6 @@ static void ngx_event_busy_lock_posted_handler(ngx_event_t *ev); * NGX_AGAIN: the all busy locks are held but we will wait the specified time * NGX_BUSY: ctx->timer == 0: there are many the busy locks * ctx->timer != 0: there are many the waiting locks - * NGX_ERROR: an error occured while the mutex locking */ ngx_int_t @@ -36,6 +35,7 @@ ngx_event_busy_lock(ngx_event_busy_lock_t *bl, ngx_event_busy_lock_ctx_t *ctx) if (bl->busy < bl->max_busy) { bl->busy++; + rc = NGX_OK; } else if (ctx->timer && bl->waiting < bl->max_waiting) { |