From: Wesley James Landaker Date: 2001-07-06T04:38:36+09:00 Subject: [ruby-talk:17342] Re: SIGUSR1/2 ? Emil Ong wrote: > Hi, > > On Fri, 6 Jul 2001, Dave Thomas wrote: > > > Emil Ong writes: > > > > > If it's not feasible, I understand, but I thought it might be useful to > > > other people using SIGUSR[12]. > > > > Could you trap the USR1 in some Ruby code, and then invoke your > > library's handlers from within that code? > > I guess the main problem is that I don't have access to the library's > signal handlers, so I can't reset them arbitrarily. I'm trying to treat > the library as an opaque API so that I can use my program with other > implementations of the same interface. Here what you can do: Initialize the library you're using. Install a dummy signal handler that does nothing, but SAVE the function pointer that returns from the signal() function. That is the OLD signal handler. Run ruby_init(); Reinstall the signal handler that you saved from the return of the signal() call when you installed your dummy handler. Voila! =)