0

I am registering an alarm signal handler as follows and an alarm signal is set every second.

  sigact.sa_handler = time_handler;
  sigemptyset(&sigact.sa_mask);
  sigact.sa_flags = SA_RESTART;
  if (sigaction(SIGALRM, &sigact, NULL) < 0)
      panic("sigaction SIGALRM: %s\n", strerror(errno));

  /* Set alarm signal every second */
  alarm(1);

My question is does the function time_handler follow a separate execution path like a thread or does it block the main process.

liv2hak
  • 14,472
  • 53
  • 157
  • 270
  • Possible duplicate of http://stackoverflow.com/questions/6129927/issue-with-timer-with-long-signal-handler-sigalarm?rq=1 – DoxyLover Jun 23 '14 at 22:28

1 Answers1

0

You can find out if you are using GNU C by adding a sleep() call in the callback, and seeing if the code afterwards is delayed.

Marco Scannadinari
  • 1,774
  • 2
  • 15
  • 24