Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-07-07 10:15:04 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-07-07 10:15:04 +0400
commitc78c41cefcf1e1fa8005f81b7c6cc0c857bcf46f (patch)
tree167a534227a7b4203892a0bb1a493a7fd4af6279 /src/os/unix
parent81a432a185bc61d46a4d5eb1f96773ee7b3dc6a3 (diff)
nginx-0.0.7-2004-07-07-10:15:04 import
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_freebsd_rfork_thread.h1
-rw-r--r--src/os/unix/ngx_process_cycle.c28
-rw-r--r--src/os/unix/ngx_thread.h1
3 files changed, 19 insertions, 11 deletions
diff --git a/src/os/unix/ngx_freebsd_rfork_thread.h b/src/os/unix/ngx_freebsd_rfork_thread.h
index 462554f28..c9ae99c09 100644
--- a/src/os/unix/ngx_freebsd_rfork_thread.h
+++ b/src/os/unix/ngx_freebsd_rfork_thread.h
@@ -85,7 +85,6 @@ static inline int ngx_gettid()
ngx_tid_t ngx_thread_self();
-#define ngx_thread_main() (ngx_gettid() == 0)
#define ngx_mutex_trylock(m) ngx_mutex_dolock(m, 1)
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index ffb8e58bc..9a46d1531 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -793,7 +793,7 @@ static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
if (ngx_threads[i].state < NGX_THREAD_EXIT) {
ngx_cond_signal(ngx_threads[i].cv);
- if (ngx_threads[i].cv->tid == -1) {
+ if (ngx_threads[i].cv->tid == (ngx_tid_t) -1) {
ngx_threads[i].state = NGX_THREAD_DONE;
} else {
live = 1;
@@ -811,6 +811,7 @@ static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
"all worker threads are joined");
/* STUB */
+ ngx_done_events(cycle);
ngx_mutex_destroy(ngx_event_timer_mutex);
ngx_mutex_destroy(ngx_posted_events_mutex);
@@ -829,10 +830,13 @@ static void* ngx_worker_thread_cycle(void *data)
sigset_t set;
ngx_err_t err;
ngx_tls_t *tls;
+ ngx_cycle_t *cycle;
struct timeval tv;
thr->cv->tid = ngx_thread_self();
+ cycle = (ngx_cycle_t *) ngx_cycle;
+
sigemptyset(&set);
sigaddset(&set, ngx_signal_value(NGX_RECONFIGURE_SIGNAL));
sigaddset(&set, ngx_signal_value(NGX_REOPEN_SIGNAL));
@@ -840,23 +844,23 @@ static void* ngx_worker_thread_cycle(void *data)
err = ngx_thread_sigmask(SIG_BLOCK, &set, NULL);
if (err) {
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, err,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
ngx_thread_sigmask_n " failed");
return (void *) 1;
}
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, ngx_cycle->log, ngx_errno,
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, ngx_errno,
"thread " TID_T_FMT " started", ngx_thread_self());
ngx_setthrtitle("worker thread");
- if (!(tls = ngx_calloc(sizeof(ngx_tls_t), ngx_cycle->log))) {
+ if (!(tls = ngx_calloc(sizeof(ngx_tls_t), cycle->log))) {
return (void *) 1;
}
err = ngx_thread_create_tls();
if (err != 0) {
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, err,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
ngx_thread_create_tls_n " failed");
return (void *) 1;
}
@@ -879,7 +883,7 @@ static void* ngx_worker_thread_cycle(void *data)
ngx_mutex_unlock(ngx_posted_events_mutex);
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, ngx_cycle->log, ngx_errno,
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, ngx_errno,
"thread %d is done", ngx_thread_self());
return (void *) 0;
@@ -887,9 +891,15 @@ static void* ngx_worker_thread_cycle(void *data)
thr->state = NGX_THREAD_BUSY;
- if (ngx_event_thread_process_posted((ngx_cycle_t *) ngx_cycle)
- == NGX_ERROR)
- {
+ if (ngx_event_thread_process_posted(cycle) == NGX_ERROR) {
+ return (void *) 1;
+ }
+
+ if (ngx_event_thread_process_posted(cycle) == NGX_ERROR) {
+ return (void *) 1;
+ }
+
+ if (ngx_process_changes(cycle, 1) == NGX_ERROR) {
return (void *) 1;
}
}
diff --git a/src/os/unix/ngx_thread.h b/src/os/unix/ngx_thread.h
index e30a148dd..b9348e89d 100644
--- a/src/os/unix/ngx_thread.h
+++ b/src/os/unix/ngx_thread.h
@@ -21,7 +21,6 @@
typedef pthread_t ngx_tid_t;
#define ngx_thread_self() pthread_self()
-#define ngx_thread_main() pthread_main_np()
#define ngx_log_tid (int) ngx_thread_self()
#define TID_T_FMT PTR_FMT