Forum: Ruby Clarrification about "trap"

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Shamika A. (Guest)
on 2009-02-02 21:10
I know in ruby we use "trap" command to handle OS signals while passing
the signal and the proc object as parameters respectively. when i call
this trap function before any infinite loop it does work perfectly.
Means it listens to the keybord signals and do as i want. But the
problem i have is that im not clear about the way it works... In c++ we
use separate thread to listen for signals and use another thread to run
the program. Is the same scenario happens here with trap
function???..... Please give me a clarification

Thanx in advance
Dominik H. (Guest)
on 2009-02-02 21:17
(Received via mailing list)
Thats how it is done:

I'm short on an explanation right now though, better let's wait for an
appropriate answer.
This topic is locked and can not be replied to.