From: Eric Wong Date: 2012-05-10T05:58:26+09:00 Subject: Re: Hooking into the VM's shutdown process "Darryl L. Pierce" wrote: > On Wed, May 9, 2012 at 11:51 AM, Quintus wrote: > > Probably you could write a C function to do the notification, then > > bridge that C function over to Ruby, and from there call it inside an > > #at_exit handler? > > Ah, thank you. Any examples of how to use that? If you don't need the Ruby API, atexit(3). Ruby 1.9.3+ also has ruby_vm_at_exit() (documented in NEWS-1.9.3, so it's likely to remain supported). Otherwise, define a Ruby method and call it via at_exit {} in Ruby: at_exit { MyModule.destroy }