diff src/os/unix/ngx_freebsd_rfork_thread.c @ 469:2ff194b74f1e release-0.1.9

nginx-0.1.9-RELEASE import *) Bugfix: the proxied request was sent without arguments if the request contains "//", "/./", "/../" or "%XX". *) Bugfix: the large compressed responses may be transferred not completely. *) Bugfix: the files bigger than 2G was not transferred on Linux that does not support sendfile64(). *) Bugfix: while the build configuration on Linux the --with-poll_module parameter was required; the bug had appeared in 0.1.8.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 25 Nov 2004 16:17:31 +0000
parents a88a3e4e158f
children d4ea69372b94
line wrap: on
line diff
--- a/src/os/unix/ngx_freebsd_rfork_thread.c
+++ b/src/os/unix/ngx_freebsd_rfork_thread.c
@@ -381,7 +381,7 @@ ngx_int_t ngx_mutex_dolock(ngx_mutex_t *
                 return NGX_AGAIN;
             }
 
-            if (ngx_freebsd_hw_ncpu > 1 && tries++ < 1000) {
+            if (ngx_ncpu > 1 && tries++ < 1000) {
 
                 /* the spinlock is used only on the SMP system */
 
@@ -581,7 +581,7 @@ ngx_cond_t *ngx_cond_init(ngx_log_t *log
     }
 
     cv->signo = NGX_CV_SIGNAL;
-    cv->tid = 0;
+    cv->tid = -1;
     cv->log = log;
     cv->kq = -1;
 
@@ -640,6 +640,8 @@ ngx_int_t ngx_cond_wait(ngx_cond_t *cv, 
             ngx_log_error(NGX_LOG_ALERT, cv->log, ngx_errno, "kevent() failed");
             return NGX_ERROR;
         }
+
+        cv->tid = ngx_thread_self();
     }
 
     if (ngx_mutex_unlock(m) == NGX_ERROR) {
@@ -714,6 +716,10 @@ ngx_int_t ngx_cond_signal(ngx_cond_t *cv
                    "cv %p to signal %P %d",
                    cv, cv->tid, cv->signo);
 
+    if (cv->tid == -1) {
+        return NGX_OK;
+    }
+
     if (kill(cv->tid, cv->signo) == -1) {
 
         err = ngx_errno;