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.
104c4948eb8f33d42b9f5161f544460e?d=identicon&s=25 Shamika Ariyawansa (shamika)
on 2009-02-02 20: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
47aff267a58c012d222fd4d74f6beb54?d=identicon&s=25 Dominik Honnef (Guest)
on 2009-02-02 20: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.