From: Joseph McDonald Date: 2001-06-29T10:15:44+09:00 Subject: [ruby-talk:17039] Re: sigprocmask JM> Is there a way to call sigprocmask in ruby? Here is an JM> example in perl: JM> # Block these signals while we're forking. JM> $sigset = POSIX::SigSet->new(SIGINT SIGTERM); JM> sigprocmask(SIG_BLOCK, $sigset) JM> or die "Can't block signals for fork: $!\n"; FYI, the reason sigprocmask is called is because: according to perl cookbook recipe 16.20: http://www.google.com/search?q=cache:x4-36hS5iMM:urth.acsu.buffalo.edu/~pjg/perlcd/cookbook/ch16_21.htm+%22the+most+paranoid+of+programmers+block+signals%22&hl=en&lr=lang_en "The most paranoid of programmers block signals for a fork to prevent a signal handler in the child process being called before Perl can update the child's $$ variable, its process id. If the signal handler were called immediately and reported $$ in that handler, it could possibly report its parent's $$, not its own. This issue does not arise often." I don't know if this could happen in ruby or not, but this is for a program that handles thousands of requests per minute and is a forker. It is currently written in perl, but I'd like that to change... :-) If this is not a concern for ruby, even better, but I'm not quite sure how to tell. I took a look at signal.c in the ruby source and see that it does use sigprocmask, but I'm not quite sure how to use it via ruby itself. thanks, -joe