aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_freebsd_rfork_thread.c12
-rw-r--r--src/os/unix/ngx_process_cycle.c7
2 files changed, 17 insertions, 2 deletions
diff --git a/src/os/unix/ngx_freebsd_rfork_thread.c b/src/os/unix/ngx_freebsd_rfork_thread.c
index 6a367bdbc..fcc716c99 100644
--- a/src/os/unix/ngx_freebsd_rfork_thread.c
+++ b/src/os/unix/ngx_freebsd_rfork_thread.c
@@ -676,14 +676,24 @@ ngx_int_t ngx_cond_wait(ngx_cond_t *cv, ngx_mutex_t *m)
ngx_int_t ngx_cond_signal(ngx_cond_t *cv)
{
+ ngx_err_t err;
+
ngx_log_debug3(NGX_LOG_DEBUG_CORE, cv->log, 0,
"cv " PTR_FMT " to signal " PID_T_FMT " %d",
cv, cv->tid, cv->signo);
if (kill(cv->tid, cv->signo) == -1) {
- ngx_log_error(NGX_LOG_ALERT, cv->log, ngx_errno,
+
+ err = ngx_errno;
+
+ ngx_log_error(NGX_LOG_ALERT, cv->log, err,
"kill() failed while signaling condition variable "
PTR_FMT, cv);
+
+ if (err == NGX_ESRCH) {
+ cv->tid = -1;
+ }
+
return NGX_ERROR;
}
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 97b301459..1a5e5c420 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -792,7 +792,12 @@ static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle)
for (i = 0; i < ngx_threads_n; i++) {
if (ngx_threads[i].state < NGX_THREAD_EXIT) {
ngx_cond_signal(ngx_threads[i].cv);
- live = 1;
+
+ if (ngx_threads[i].cv->tid == -1) {
+ ngx_threads[i].state = NGX_THREAD_DONE;
+ } else {
+ live = 1;
+ }
}
if (ngx_threads[i].state == NGX_THREAD_EXIT) {