From ustaudinger at activequant.com  Sat Nov 17 16:56:04 2012
From: ustaudinger at activequant.com (Ulrich Staudinger)
Date: Sat, 17 Nov 2012 16:56:04 +0100
Subject: [Rd] Sighandlers
Message-ID: <CAMrz3D0MNwuiYRiqGWOh8AAT6rcdAbppi9BDZ9EvqqDiSdQ8_Q@mail.gmail.com>

Hello everyone,

I am searching and searching and can't find an answer.

I try to register a sighandler in my extension's C code. But my
sighandler is never called. Is there anything preventing extensions to
receive signals?

I register like this:

[.. some code that works ..]
      // register the sigint listeners.
      if (signal(SIGTERM, killReceiver) == SIG_ERR) {
        printf("2 An error occurred while setting a signal
handler.%s\n", stderr);
      }
      if (signal(SIGHUP, killReceiver) == SIG_ERR) {
        printf("3 An error occurred while setting a signal
handler.%s\n", stderr);
      }
      if (signal(SIGINT, killReceiver) == SIG_ERR) {
        printf("4 An error occurred while setting a signal
handler.%s\n", stderr);
      }
[.. even more code that works ..]


handler code:

static void killReceiver(int signum){
  printf("Cleaning up\n");
}


When I exit R, my signal handler is not being called. Am I listening
to the right signals? Do I have some misunderstanding on my side?

Funny side story, if I manually raise(SIGINT), my handlers gets called.


Thanks for some light on this,

Ulrich





--
Ulrich Staudinger

P: +41 79 702 05 95
E: ustaudinger at activequant.com

http://www.activequant.com
Connect online: https://www.xing.com/profile/Ulrich_Staudinger



[Rd] Sighandlers
Ulrich Staudinger