This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: REVISITED: Signal delivered while blocked


On Wed, 16 Aug 2017 23:22:31, Houder wrote:
> 
> Hi,
> 
> Please read this post first:
> 
>      https://cygwin.com/ml/cygwin/2017-08/msg00048.html
>      ( Signal delivered while blocked -- by Noah Misch, August 4th 2017 )
> 
> This post is not intended to "hijack" the post by Noah Misch; this post 
> only ships an alternative (i.e. revised) testcase for the one by provided
> by Noah Misch.
> 
> The alternative testcase in fact consists of 2 testcases (2 files):
> 
>   1. sigprocmask-exclusion4.c
>   2. sigprocmask-exclusion5.c

Only for those interested ...

I made a minor modification to the 2nd testcase (sigprocmask-exclusion5.c) (in
order to get it theoretically correct).

I modified the last part (bottom) of each handler. See below.

On request, I will upload the files again.

Regards,

Henri

-----
handler(): // old

#if defined(option1)
	if (sigprocmask(SIG_SETMASK, &oset, NULL) != 0) // herstel
		perror("sigprocmask");
#else
	r = sigdelset(&set, SIGCHLD);
	if (r != 0) puts("retvalH1b");
	if (sigprocmask(SIG_UNBLOCK, &set, NULL) != 0) // verwijder
		perror("sigprocmask");
				  // Cygwin: aborts, almost immediately
#endif
}

handler(): // new

#if defined(option1)
	if (sigprocmask(SIG_SETMASK, &oset, NULL) != 0) // herstel
		perror("sigprocmask");
#else
	{
		int rv = 0;
		if ( (rv = sigismember(&oset, SIGCHLD)) == -1)
			perror("sigismember");
		// if the other signal was enabled at the beginning, enable it again
		if (rv == 0) {
			if (sigprocmask(SIG_UNBLOCK, &set, NULL) != 0) // verwijder
				perror("sigprocmask");
		}
	}
#endif
}

-----
handler2(): // old

#if defined(option1)
	if (sigprocmask(SIG_SETMASK, &oset, NULL) != 0) // herstel
		perror("sigprocmask");
#else
	r = sigdelset(&set, SIGUSR1);
	if (r != 0) puts("retvalH2b");
	if (sigprocmask(SIG_UNBLOCK, &set, NULL) != 0) // verwijder
		perror("sigprocmask");
#endif
}

handler2(): // new

#if defined(option1)
	if (sigprocmask(SIG_SETMASK, &oset, NULL) != 0) // herstel
		perror("sigprocmask");
#else
	{
		int rv = 0;
		if ( (rv = sigismember(&oset, SIGUSR1)) == -1)
			perror("sigismember");
		// if the other signal was enabled at the beginning, enable it again
		if (rv == 0) {
			if (sigprocmask(SIG_UNBLOCK, &set, NULL) != 0) // verwijder
				perror("sigprocmask");
		}
	}
#endif
}

=====


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]