[Patch] Signal mask handling

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Thu Mar 11 05:48:00 GMT 2004

On Wed, Mar 10, 2004 at 11:26:19PM -0500, Pierre A. Humblet wrote:
>2004-02-11  Pierre Humblet <pierre.humblet@ieee.org>
>	* gendef (_sigdelayed): Replace the call to 
>	set_process_mask by a call to set_process_mask_delta.
>	* exceptions.cc (_cygtls::interrupt_setup): Set oldmask
>	to the delta and don't set newmask.
>	(set_process_mask_delta): New function.
>	(_cygtls::call_signal_handler): Replace the first call to 
>	set_process_mask by a call to set_process_mask_delta.

I tried applying this patch and saw a difference in behavior with
the attached program.  It wasn't setting the signal mask in the handler
correctly.  I have changes in my sandbox which conflicted with your
patch, so I probably misapplied something, though since your patch
looks correct to me otherwise.

Can you confirm the same behavior on the below program before and
after your change?  If so, I'd say it's ok to check in but I'd like to
check my changes in first.  I hope to have them completed soon.

Btw, I think that if you check this in, set_process_mask becomes
obsolete, right?

-------------- next part --------------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>

ouch (int sig)
  sigset_t set, oset;
  sigemptyset (&set);
  sigprocmask (SIG_SETMASK, &set, &oset);
  sigprocmask (SIG_SETMASK, NULL, &set);
  printf ("sig %d, set 0%x, oset 0%x\n", sig, set, oset);

main (int argc, char **argv)
  sigset_t set, oset;
  sigemptyset (&set);
  sigaddset (&set, SIGUSR1);
  sigaddset (&set, SIGINT);
  sigprocmask (SIG_SETMASK, &set, &oset);
  printf ("set 0%x, oset 0%x\n", set, oset);
  signal (SIGALRM, ouch);
  alarm (1);
  pause ();
  sigprocmask (SIG_SETMASK, NULL, &oset);
  printf ("oset 0%x\n", oset);
  exit (0);

More information about the Cygwin-patches mailing list