changeset 382:449c4885dcd1

nginx-0.0.7-2004-07-07-23:48:31 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 07 Jul 2004 19:48:31 +0000
parents 02a511569afb
children c05876036128
files auto/threads src/core/ngx_config.h src/event/modules/ngx_rtsig_module.c src/os/unix/ngx_process_cycle.c src/os/unix/ngx_thread.h
diffstat 5 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/auto/threads
+++ b/auto/threads
@@ -30,6 +30,15 @@ case $USE_THREADS in
         CORE_LIBS="$CORE_LIBS -pthread"
     ;;
 
+    linuxthreads)
+        have=NGX_THREADS . auto/have
+        have=NGX_LINUXTHREADS . auto/have
+        CFLAGS="$CFLAGS -D_THREAD_SAFE"
+        CFLAGS="$CFLAGS -I /usr/local/include/pthread/linuxthreads"
+        CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
+        CORE_LIBS="$CORE_LIBS -L /usr/local/lib -llthread -llgcc_r"
+    ;;
+
     lc_r)
         have=NGX_THREADS . auto/have
         CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -41,8 +41,14 @@
 #define NGX_TERMINATE_SIGNAL     TERM
 #define NGX_NOACCEPT_SIGNAL      WINCH
 #define NGX_RECONFIGURE_SIGNAL   HUP
+
+#if (NGX_LINUXTHREADS)
+#define NGX_REOPEN_SIGNAL        INFO
+#define NGX_CHANGEBIN_SIGNAL     XCPU
+#else
 #define NGX_REOPEN_SIGNAL        USR1
 #define NGX_CHANGEBIN_SIGNAL     USR2
+#endif
 
 #endif
 
--- a/src/event/modules/ngx_rtsig_module.c
+++ b/src/event/modules/ngx_rtsig_module.c
@@ -363,6 +363,9 @@ ngx_int_t ngx_rtsig_process_events(ngx_c
     if (signo == -1) {
         err = ngx_errno;
 
+        ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, err,
+                       "rtsig signo:%d", signo);
+
         if (err == NGX_EAGAIN) {
 
             if (timer == NGX_TIMER_INFINITE) {
@@ -377,6 +380,9 @@ ngx_int_t ngx_rtsig_process_events(ngx_c
 
     } else {
         err = 0;
+        ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+                       "rtsig signo:%d fd:%d band:%X",
+                       signo, si.si_fd, si.si_band);
     }
 
     ngx_gettimeofday(&tv);
@@ -399,9 +405,6 @@ ngx_int_t ngx_rtsig_process_events(ngx_c
                        "rtsig timer: %d, delta: %d", timer, (int) delta);
     }
 
-    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
-                   "rtsig signo:%d fd:%d band:%X", signo, si.si_fd, si.si_band);
-
     rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
 
     if (signo == rtscf->signo || signo == rtscf->signo + 1) {
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -858,7 +858,7 @@ static void* ngx_worker_thread_cycle(voi
         return (void *) 1;
     }
 
-    ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, ngx_errno,
+    ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0,
                    "thread " TID_T_FMT " started", ngx_thread_self());
 
     ngx_setthrtitle("worker thread");
--- a/src/os/unix/ngx_thread.h
+++ b/src/os/unix/ngx_thread.h
@@ -22,7 +22,11 @@ typedef pthread_t                    ngx
 #define ngx_thread_self()            pthread_self()
 #define ngx_log_tid                  (int) ngx_thread_self()
 
+#if defined(__FreeBSD__) && !defined(NGX_LINUXTHREADS)
 #define TID_T_FMT                    PTR_FMT
+#else
+#define TID_T_FMT                    "%d"
+#endif
 
 
 typedef pthread_key_t                ngx_tls_key_t;