From: Venkat Akkineni Date: 2010-12-18T23:10:10+09:00 Subject: Re: background threads Mike Thanks for your reply. The flag is wrong indeed. I didn't notice this because the 'else' part of setSignal never gets executed with the current setup. You will notice that the program runs exactly the same way even when all commands inside setSignal except call to display function are commented. def setSignal(signal) # if signal == true display # else # self.aFlag=true # end end When I change the display function to the following def display self.run sleep 20 end program prints 'I am here' after 20 seconds. The reason I did not have an argument for sleep is I wan't the thread run indefinitely until I call it off some how. This is the desired effect. Two approaches I have tried are 1.) loop through indefinitely around necessary code block. 2.) create a thread around the above loop and call Thread.join. Both the above approaches stop execution where ever these blocks are called from. Hence I am unable to push the execution of the thread to the background. Your thoughts and help ... Thanks Venkat -- Posted via http://www.ruby-forum.com/.