Mail Archives: cygwin-developers/2001/03/10/15:42:38
--Multipart_Sun_Mar_11_05:41:47_2001-1
Content-Type: text/plain; charset=US-ASCII
The test program attached below shows the following behavior on
NT4 Sp6a and the latest Cygwin DLL.
1. Blocked signals are queued.
2. One of them are dequeued when the block is released.
3. Others are dequeued two by two when other signals are triggered.
The following illustrates the output of the program.
HANDLER1
SIGUSR1
(sleep 5sec.)
HANDLER1
SIGUSR1
HANDLER2
SIGUSR2
HANDLER1
SIGUSR1
(sleep 5sec.)
HANDLER1
SIGUSR1
HANDLER2
SIGUSR2
HANDLER1
SIGUSR1
(sleep 5sec.)
...
This behavior isn't compatible with typical UNIX. I believe the
Cygwin DLL shouldn't queue blocked signals and should deliver
only one of them.
--Multipart_Sun_Mar_11_05:41:47_2001-1
Content-Type: text/plain; charset=US-ASCII
#include<signal.h>
#include<unistd.h>
#include<stdio.h>
#include<errno.h>
void
recvsig1(int sig)
{
puts("HANDLER1");
switch(sig)
{
case SIGUSR1:
puts("SIGUSR1");
break;
case SIGUSR2:
puts("SIGUSR2");
break;
default:
puts("UNKNOWN");
break;
}
}
void
recvsig2(int sig)
{
puts("HANDLER2");
switch(sig)
{
case SIGUSR1:
puts("SIGUSR1");
break;
case SIGUSR2:
puts("SIGUSR2");
break;
default:
puts("UNKNOWN");
break;
}
}
int
main()
{
int i;
int pid = getpid();
static sigset_t unblock,block,old;
signal (SIGUSR1,recvsig1);
signal (SIGUSR2,recvsig2);
sigfillset (&block);
sigemptyset (&unblock);
sigprocmask (SIG_SETMASK,&block,&old);
for(i = 0; i < 5; i++)
kill(pid,SIGUSR1);
sigprocmask(SIG_SETMASK,&unblock,&old);
sleep(5);
for(i=0; i < 5; i++) {
kill(pid,SIGUSR2);
sleep(5);
}
}
--Multipart_Sun_Mar_11_05:41:47_2001-1
Content-Type: text/plain; charset=US-ASCII
____
| AIST Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT jp>
| HOKURIKU School of Information Science
o_/ 1990 Japan Advanced Institute of Science and Technology
--Multipart_Sun_Mar_11_05:41:47_2001-1--
- Raw text -