Manfred Spraul wrote:
> Bruce Momjian wrote:
> 
> >> 
> >>+   /*
> >>+    *      We could lose a signal during this test.
> >>+    *      In a multi-threaded application, this might
> >>+    *      be a problem.  Do any non-threaded platforms
> >>
> Threaded or non-threaded?
> 
> >>+    *      lack sigaction()?
> >>+    */
> >>
> Additionally, the problem is not restricted to multithreaded apps: 
> signal(,SIG_IGN) clears all pending signals.

OK, new function using sigblock():
        
        pqsigfunc
        pqsignalinquire(int signo)
        {
        #if !defined(HAVE_POSIX_SIGNALS)
            pqsigfunc old_sigfunc;
            int     old_sigmask;
        
            /* Prevent signal handler calls during test */
            old_sigmask = sigblock(sigmask(signo));
            old_sigfunc = signal(signo, SIG_DFL);
            signal(signo, old_sigfunc);
            sigblock(old_sigmask);
            return old_sigfunc;
        #else
            struct sigaction oact;
        
            if (sigaction(signo, NULL, &oact) < 0)
               return SIG_ERR;
            return oact.sa_handler;
        #endif   /* !HAVE_POSIX_SIGNALS */
        }

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to