From: Joseph McDonald Date: 2001-06-30T17:56:28+09:00 Subject: [ruby-talk:17101] Re: ensure block not being executed AG> Then what is MessageQueue? (I haven't foud it at my Ruby sources ) It is part of sysvipc: http://deisui.bug.org/~ueno/ruby/sysvipc.html Pretty useful stuff! AG> Can it on ctrl+c terminate the process without passing control to Ruby's AG> "atexit" functions? It's interesting that if I define an at_exit function, it will run on ctrl+c but the ensure block does not: require 'sysvipc' include SystemVIPC begin key = ftok __FILE__, 1 msq = MessageQueue.new key, 0700 | IPC_CREAT at_exit { puts "in at_exit block" msq.remove } # enqueue messages 0.upto(1) do |x| msq.send 100, x.to_s end # dequeue messages while (s = msq.recv 100, 100) puts "got: #{s}" end # remove the queue ensure puts "ensure block" msq.remove end joe@merry:~$ !. ./junker.rb got: 0 got: 1 ^C./junker.rb:27: Interrupt in at_exit block thanks, -joe