]> sourceware.org Git - newlib-cygwin.git/commitdiff
* sigproc.cc (sig_hold): Delete.
authorChristopher Faylor <me@cgf.cx>
Thu, 16 May 2013 05:36:15 +0000 (05:36 +0000)
committerChristopher Faylor <me@cgf.cx>
Thu, 16 May 2013 05:36:15 +0000 (05:36 +0000)
(sigheld): Delete.
(sig_send): Eliminate special-case __SIGHOLD handling.
(wait_sig): Just flag when signals are on hold and add them to the queue rather
than stalling the wait_sig loop.  Clear the flag when __SIGNOHOLD is specified.

winsup/cygwin/ChangeLog
winsup/cygwin/sigproc.cc

index 9be2eeb6a8b5dfb097ac9f0b970da97a31132619..3b685861fae0f578a41d52b81ac24477b7ee7890 100644 (file)
@@ -1,3 +1,12 @@
+2013-05-16  Christopher Faylor  <me.cygwin2013@cgf.cx>
+
+       * sigproc.cc (sig_hold): Delete.
+       (sigheld): Delete.
+       (sig_send): Eliminate special-case __SIGHOLD handling.
+       (wait_sig): Just flag when signals are on hold and add them to the
+       queue rather than stalling the wait_sig loop.  Clear the flag when
+       __SIGNOHOLD is specified.
+
 2013-05-14  Corinna Vinschen  <corinna@vinschen.de>
 
        * Makefile.in (devices_CFLAGS): Drop -Os.
index 9deb926def0e39e69f183ca45b215b151133ec4e..cf9053804b45edc99a72ed9c1f9520d6a3794e87 100644 (file)
@@ -44,8 +44,6 @@ char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes
 
 #define Static static NO_COPY
 
-Static HANDLE sig_hold;                        // Used to stop signal processing
-Static bool sigheld;                   // True if holding signals
 
 Static int nprocs;                     // Number of deceased children
 Static char cprocs[(NPROCS + 1) * sizeof (pinfo)];// All my children info
@@ -478,24 +476,6 @@ exit_thread (DWORD res)
 int __reg3
 sig_send (_pinfo *p, int sig, _cygtls *tid)
 {
-  if (sig == __SIGHOLD)
-    sigheld = true;
-  else if (!sigheld)
-    /* nothing */;
-  else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST)
-    return 0;
-  else if (sig == __SIGNOHOLD)
-    {
-      SetEvent (sig_hold);
-      sigheld = false;
-    }
-  else if (&_my_tls == _main_tls)
-    {
-#ifdef DEBUGGING
-      system_printf ("signal %d sent to %p while signals are on hold", sig, p);
-#endif
-      return -1;
-    }
   siginfo_t si = {};
   si.si_signo = sig;
   si.si_code = SI_KERNEL;
@@ -1226,7 +1206,7 @@ static void WINAPI
 wait_sig (VOID *)
 {
   _sig_tls = &_my_tls;
-  sig_hold = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
+  bool sig_held = false;
 
   sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
                  my_readsig, my_sendsig);
@@ -1275,33 +1255,7 @@ wait_sig (VOID *)
              *pack.mask |= bit;
          break;
        case __SIGHOLD:
-         goto loop;
-         break;
-       default:
-         if (pack.si.si_signo < 0)
-           sig_clear (-pack.si.si_signo);
-         else
-           sigq.add (pack);
-       case __SIGNOHOLD:
-       case __SIGFLUSH:
-       case __SIGFLUSHFAST:
-         {
-           sigpacket *qnext;
-           /* Check the queue for signals.  There will always be at least one
-              thing on the queue if this was a valid signal.  */
-           while ((qnext = q->next))
-             {
-               if (qnext->si.si_signo && qnext->process () <= 0)
-                 q = q->next;
-               else
-                 {
-                   q->next = qnext->next;
-                   qnext->si.si_signo = 0;
-                 }
-             }
-           if (pack.si.si_signo == SIGCHLD)
-             clearwait = true;
-         }
+         sig_held = true;
          break;
        case __SIGSETPGRP:
          init_console_handler (true);
@@ -1328,16 +1282,41 @@ wait_sig (VOID *)
              }
          }
          break;
+       default:
+         if (pack.si.si_signo < 0)
+           sig_clear (-pack.si.si_signo);
+         else
+           sigq.add (pack);
+       case __SIGNOHOLD:
+         sig_held = false;
+       case __SIGFLUSH:
+       case __SIGFLUSHFAST:
+         if (!sig_held)
+           {
+             sigpacket *qnext;
+             /* Check the queue for signals.  There will always be at least one
+                thing on the queue if this was a valid signal.  */
+             while ((qnext = q->next))
+               {
+                 if (qnext->si.si_signo && qnext->process () <= 0)
+                   q = q->next;
+                 else
+                   {
+                     q->next = qnext->next;
+                     qnext->si.si_signo = 0;
+                   }
+               }
+             if (pack.si.si_signo == SIGCHLD)
+               clearwait = true;
+           }
+         break;
        }
       if (clearwait && !have_execed)
        proc_subproc (PROC_CLEARWAIT, 0);
-    loop:
       if (pack.wakeup)
        {
          sigproc_printf ("signalling pack.wakeup %p", pack.wakeup);
          SetEvent (pack.wakeup);
        }
-      if (pack.si.si_signo == __SIGHOLD)
-       WaitForSingleObject (sig_hold, INFINITE);
     }
 }
This page took 0.038215 seconds and 5 git commands to generate.