comparison src/os/unix/ngx_process_cycle.c @ 279:b79f021a644a

nginx-0.0.2-2004-03-04-19:34:23 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 04 Mar 2004 16:34:23 +0000
parents 0ba4821f4460
children 87e73f067470
comparison
equal deleted inserted replaced
278:0ba4821f4460 279:b79f021a644a
93 93
94 for (i = 0; ngx_modules[i]; i++) { 94 for (i = 0; ngx_modules[i]; i++) {
95 if (ngx_modules[i]->init_process) { 95 if (ngx_modules[i]->init_process) {
96 if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) { 96 if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
97 /* fatal */ 97 /* fatal */
98 exit(1); 98 exit(2);
99 } 99 }
100 } 100 }
101 } 101 }
102 } 102 }
103 103
416 416
417 for (i = 0; ngx_modules[i]; i++) { 417 for (i = 0; ngx_modules[i]; i++) {
418 if (ngx_modules[i]->init_process) { 418 if (ngx_modules[i]->init_process) {
419 if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) { 419 if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
420 /* fatal */ 420 /* fatal */
421 exit(1); 421 exit(2);
422 } 422 }
423 } 423 }
424 } 424 }
425 425
426 ngx_setproctitle("worker process"); 426 ngx_setproctitle("worker process");
427 427
428 #if (NGX_THREADS) 428 #if (NGX_THREADS)
429 429
430 if (ngx_init_threads(5, 128 * 1024 * 1024, cycle) == NGX_ERROR) { 430 if (ngx_init_threads(5, 128 * 1024 * 1024, cycle) == NGX_ERROR) {
431 /* fatal */ 431 /* fatal */
432 exit(1); 432 exit(2);
433 } 433 }
434 434
435 for (i = 0; i < 1; i++) { 435 for (i = 0; i < 1; i++) {
436 if (ngx_create_thread(&tid, ngx_worker_thread_cycle, 436 if (ngx_create_thread(&tid, ngx_worker_thread_cycle,
437 cycle, cycle->log) != 0) 437 cycle, cycle->log) != 0)
438 { 438 {
439 /* fatal */ 439 /* fatal */
440 exit(1); 440 exit(2);
441 } 441 }
442 } 442 }
443 443
444 #endif 444 #endif
445 445
492 492
493 int ngx_worker_thread_cycle(void *data) 493 int ngx_worker_thread_cycle(void *data)
494 { 494 {
495 ngx_cycle_t *cycle = data; 495 ngx_cycle_t *cycle = data;
496 496
497 ngx_err_t err;
498 sigset_t set;
497 struct timeval tv; 499 struct timeval tv;
500
501 sigfillset(&set);
502 sigdelset(&set, SIGALRM);
503 sigdelset(&set, ngx_signal_value(NGX_TERMINATE_SIGNAL));
504 sigdelset(&set, ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
505
506 err = ngx_thread_sigmask(SIG_BLOCK, &set, NULL);
507 if (err) {
508 ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
509 ngx_thread_sigmask_n " failed");
510 return 1;
511 }
512
498 513
499 /* STUB */ 514 /* STUB */
500 515
501 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ngx_cycle->log, ngx_errno, 516 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ngx_cycle->log, ngx_errno,
502 "thread %d started", ngx_thread_self()); 517 "thread %d started", ngx_thread_self());