Add signal blocking. signal handlers may call pool_error() etc.
authorTatsuo Ishii <ishii at sraoss.co.jp>
Mon, 17 Apr 2006 04:07:09 +0000 (04:07 +0000)
committerTatsuo Ishii <ishii at sraoss.co.jp>
Mon, 17 Apr 2006 04:07:09 +0000 (04:07 +0000)
while processing. This is not good for them. For example,
messages might be confused.

pool_error.c

index 9ededbf792063e4074fcc54f0cef853e89b29571..43f8bdb6fee2563200fd506f0b3a712777041739 100644 (file)
@@ -43,6 +43,8 @@ void pool_error(const char *fmt,...)
        char            *fmt2;
 #endif
 
+       POOL_SETMASK(&BlockSig);
+
        if (pool_config.print_timestamp)
 #ifdef HAVE_ASPRINTF
          asprintf(&fmt2, "%s ERROR: pid %d: %s\n", nowsec(), (int)getpid(), fmt);
@@ -67,6 +69,8 @@ void pool_error(const char *fmt,...)
        va_end(ap);
        fprintf(stderr, "\n");
 #endif
+
+       POOL_SETMASK(&UnBlockSig);
 }
 
 void pool_debug(const char *fmt,...)
@@ -79,6 +83,8 @@ void pool_debug(const char *fmt,...)
        if (!debug)
                return;
 
+       POOL_SETMASK(&BlockSig);
+
        if (pool_config.print_timestamp)
 #ifdef HAVE_ASPRINTF
          asprintf(&fmt2, "%s DEBUG: pid %d: %s\n", nowsec(), (int)getpid(), fmt);
@@ -103,6 +109,8 @@ void pool_debug(const char *fmt,...)
        va_end(ap);
        fprintf(stderr, "\n");
 #endif
+
+       POOL_SETMASK(&UnBlockSig);
 }
 
 void pool_log(const char *fmt,...)
@@ -112,6 +120,8 @@ void pool_log(const char *fmt,...)
        char            *fmt2;
 #endif
 
+       POOL_SETMASK(&BlockSig);
+
        if (pool_config.print_timestamp)
 #ifdef HAVE_ASPRINTF
          asprintf(&fmt2, "%s LOG:   pid %d: %s\n", nowsec(), (int)getpid(), fmt);
@@ -136,6 +146,8 @@ void pool_log(const char *fmt,...)
        va_end(ap);
        fprintf(stderr, "\n");
 #endif
+
+       POOL_SETMASK(&UnBlockSig);
 }
 
 static char *nowsec(void)