* 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.
This commit is contained in:
		| @@ -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. | ||||
|   | ||||
| @@ -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); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user