From: Lloyd Zusman Date: 2001-04-30T00:10:09+09:00 Subject: [ruby-talk:14406] Re: [REPOST] Retrieving current signal handler without altering it "David S." writes: > On Sun, Apr 29, 2001 at 01:40:04PM +0900, Phil Tomson wrote: > > > > > >I'd like to retrieve the current handler for a given signal without > > >changing it. I know that I can do this: > > > > > How about: > > > > currentHandler = trap('HUP','DEFAULT') > > > > I think that's what you're looking for. > > That command will set the handler to the default. If that's not what you > want, you have to restore it with > > trap('HUP', currentHandler) > > which introduces a race condition. Without an interface to 'sigaction', > I don't think you can safely retrieve a signal handler. Well, in Perl, you can do this ... $currentHandler = $SIG{'HUP'}; The Perl interpreter ensures that the %SIG hash always contains references to the current handler routine for a given signal, if there is one. Could such a thing be added to Ruby? > David S. -- Lloyd Zusman ljz@asfast.com