From: Ashley Moran Date: 2006-04-23T20:51:34+09:00 Subject: Re: How do threads and join work? On Apr 23, 2006, at 12:33 pm, Pat Maddox wrote: > Right, I mentioned that in my OP. I want to know if there's a way to > get join-like behavior - do not terminate the program until that > thread has finished executing - without blocking. > > This gives the output I want, but doesn't actually perform what I > want. The ultimate goal here is to basically tell my program "Go > start doing this in the background, and I'm going to keep working." Sorry - missed your final point because I forgot to scroll down. In future I won't write replies first thing Sunday morning :) You can never join on your thread because it can only be terminated (cleanly) by setting the value of running to false I don't see what's wrong with this (going back to your original code): running = true t = Thread.new do print "Thread started\n" while(running); end print "Thread finished\n" end do_work # Use one or: other of these depending on whether t is immortal running = false #t.join #puts "After join" puts "Program finished" Maybe I have misunderstood whether you want to be in control of a thread that will run forever, or whether your while loop is just to simulate a long-running process? Ashley