From: Emil Ong Date: 2001-07-06T06:29:58+09:00 Subject: [ruby-talk:17349] Re: SIGUSR1/2 ? Hi, On Fri, 6 Jul 2001, Wesley James Landaker wrote: > (This doesn't solve the synchronization problem, but I thought I'd mention > this: ...) > > BTW, you can also do the same sort of thing, except actually still use ruby's > signal handlers. You'd basically do the following pseudo-code (where let's > assume sighandler_t is a signal handler function pointer): > > sighandler_t otherAPIhandler; > sighandler_t rubyhandler; > > sighandler_t myhandler() { > otherAPIhandler(); > rubyhandler(); > } > > void setupstuff() { > init_other_API(); > otherAPIhandler = signal(SIGUSR1, myhandler); > ruby_init(); > rubyhandler = signal(SIGUSR1, myhandler); > } > > Then when the signal is triggered, it will call YOUR handler, which as you can > see above, could just call the other API's handler, and the ruby handler > sequentially. > > Of course, I haven't actually TRIED this, and I'm not sure what ruby is > doing in their handler, so maybe this would have problems, but it > doesn't seem like it. It looks like ruby is raising a signal exception when it gets a SIGUSR[12], so I don't want that. ;) Still, this is yet another cool trick for my signal handling toolbox. Thanks again! Emil