Loading ...
Sorry, an error occurred while loading the content.


Expand Messages
  • clerew5
    Oct 21, 2010
    • 0 Attachment
      The following program works fine on my SPARC solaris system:

      #include <stdio.h>
      #include <stdlib.h>
      #include <ctype.h>
      #include <sys/types.h>
      #include <unistd.h>
      #include <signal.h>

      sigset_t blockset;

      int count = 0;

      take_action(int signal)
      printf("%d\n", count++);

      int signal;
      sigaddset(&blockset, SIGUSR1);

      while(1) {
      sigwait(&blockset, &signal);

      It sits in a loop waiting for a SIGUSR1 signal, and when it comes it prints out that it has seen it. The intention is that if several such signals are received in rapid succession, the first will be actioned and the rest will be queued up and processed on subsequent cycles of the loop. At least, that is AIUI what POSIX says, and also what the slug manual pages seem to imply.

      However, running that same program on slugos 5.3, and giving it a
      kill -s USR1 <pid of program>
      it immediately takes the default action of SIGUSR1 (which is to terminate), even though it is sitting in a sigwait for SIGUSR1 at the time. So I never get to try the effect of multiple kills in rapid succession.

      In Solaris, I gave it
      kill -s USR1 <pid of program>;kill -s USR1 <pid of program>;kill -s USR1 <pid of program>
      and it happily ran take_action three times.

      Why doesn't this work in slugos, and what am I doing wrong?
    • Show all 2 messages in this topic