| 677 | #endif |
| 678 | |
| 679 | static ngx_int_t |
| 680 | ngx_event_process_init(ngx_cycle_t *cycle) |
| 681 | { |
| 682 | ngx_uint_t m, i; |
| 683 | ngx_event_t *rev, *wev; |
| 684 | ngx_listening_t *ls; |
| 685 | ngx_connection_t *c, *next, *old; |
| 686 | ngx_core_conf_t *ccf; |
| 687 | ngx_event_conf_t *ecf; |
| 688 | ngx_event_module_t *module; |
| 689 | |
| 690 | ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
| 691 | ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); |
| 692 | |
| 693 | if (ccf->master && ccf->worker_processes > 1 && ecf->accept_mutex) { |
| 694 | ngx_use_accept_mutex = 1; |
| 695 | ngx_accept_mutex_held = 0; |
| 696 | ngx_accept_mutex_delay = ecf->accept_mutex_delay; |
| 697 | |
| 698 | } else { |
| 699 | ngx_use_accept_mutex = 0; |
| 700 | } |
| 701 | |
| 702 | #if (NGX_WIN32) |
| 703 | |
| 704 | /* |
| 705 | * disable accept mutex on win32 as it may cause deadlock if |
| 706 | * grabbed by a process which can't accept connections |
| 707 | */ |
| 708 | |
| 709 | ngx_use_accept_mutex = 0; |
| 710 | |
| 711 | #endif |
| 712 | |
| 713 | ngx_use_exclusive_accept = 0; |
| 714 | |
| 715 | ngx_queue_init(&ngx_posted_accept_events); |
| 716 | ngx_queue_init(&ngx_posted_next_events); |
| 717 | ngx_queue_init(&ngx_posted_events); |
| 718 | |
| 719 | if (ngx_event_timer_init(cycle->log) == NGX_ERROR) { |
| 720 | return NGX_ERROR; |
| 721 | } |
| 722 | |
| 723 | for (m = 0; cycle->modules[m]; m++) { |
| 724 | if (cycle->modules[m]->type != NGX_EVENT_MODULE) { |
| 725 | continue; |
| 726 | } |
| 727 | |
| 728 | if (cycle->modules[m]->ctx_index != ecf->use) { |
| 729 | continue; |
| 730 | } |
| 731 | |
| 732 | module = cycle->modules[m]->ctx; |
| 733 | |
| 734 | if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) { |
| 735 | /* fatal */ |
| 736 | exit(2); |
nothing calls this directly
no test coverage detected