From: Venkat Akkineni Date: 2010-12-21T07:24:36+09:00 Subject: Re: background threads Hello Robert Thanks for your code and help. By commenting a few lines in your code I will try to make my argument. if you comment out the following lines in the code above. You will notice that the thread exists only momentarily even with the join. It won't even print the "Background" the first time. #10.times do |i| # printf "%-20s %5d\n", "Foreground", i # sleep 3 #end While I could use a loop like the one above, it will stop all execution at that point until the hamster has run its length. How can I change the code so that the main thread respects the currently running thread and let it do its thing before it exists. Notice that I have read the documentation and understand that when main thread exits it will kill all the running threads. Also my code attached to the email. It is a simple window class that uses SDL. SDL window stays alive as long as there is a loop right next to window initialization. -> When add the loop in a method and call it from some where else . The execution stops at the line I am calling it. -> So I thought creating a new thread will help, but when I create a thread window appears for an instant and disappears. -> I try adding thread.join right after creating an instance of a class that encloses window creation. This causes freezing of the execution at thread.join I am pretty sure that I am going about this the wrong way but not sure what is the right way. Thanks Venkat Attachments: http://www.ruby-forum.com/attachment/5607/window.rb -- Posted via http://www.ruby-forum.com/.