The main problem is you have a little misunderstand of thread. Based on your code, when the child thread is forked, there is nothing more for the main thread to do. So it joins the child thread immediately. And what is the child thread doing? Sleeping. So it looks like your program is sleeping. Poncho Quintanilla wrote: > I'm trying to schedule some task using ruby threads > > This work great: > > t = Thread.new do > while true do > puts "Starting new job at #{Time.now}" > do_something > sleep 3 > end > end > t.join > > But when the task take a long, like: > > def do_something > puts "doing something at#{Time.now}" > sleep(rand(3)) > end > > I cant get the "Starting new job" message appears in regular intervals > of 3 seconds. What I'm missing? > > Thanks >