Robert Klemme wrote: > Jacek Olszak wrote: >>>>> Jacek >>>> until >>> with Bill solution) >> end >> >> b.join > > Are you aware of the fact that ruby will exit as soon as the main thread > exits? Yes... I know... So your difference might well be timing related. > > 10:58:20 [source]: ruby -e 'Thread.new { sleep 1; puts "end" }' > 10:59:22 [source]: ruby -e 'Thread.new { sleep 1; puts "end" }; sleep 2' > end > 10:59:28 [source]: > > Notice how the first piece doesn't print? That's because the main > thread > simply exits killing the sleeping first thread. > > Again, I don't know what you're up to so it's difficult to provide > advice > how to do it right. In your simple example thread a is pointless IMHO - > you could do that as well in the main thread. > The problem is with windows - gets command blocks every thread in application. In my example the b thread is automatically started. In the same time in a thread, gets command waits for user input. But in fact, on windows platform gets command blocks everything, so nothing is done in "b" thread. And I want to write an application which do something in the background, and wait for user input at the same time (on windows it's currently impossible :( ) Regards Jacek -- Posted via http://www.ruby-forum.com/.