From: 7stud -- Date: 2007-10-26T01:55:26+09:00 Subject: Re: Starting Threads K. R. wrote: > Hi @all > I've many different threads to run parallel. Some of these have a > special feature. At the starttime, I decide with a variable, which > threads must sleep for 5 ms. The others can start now. > > How can I realize this problem?? > > thanks... Try something like this: x = 1 threads = [] 10.times do |i| threads << Thread.new(x) do |my_var| if my_var < 5 my_var = 10 sleep(0.05) end puts "thread #{i} executing" end end threads.each do |thr| thr.join end --output:-- thread 4 executing thread 3 executing thread 2 executing thread 1 executing thread 0 executing thread 9 executing thread 8 executing thread 7 executing thread 6 executing thread 5 executing -- Posted via http://www.ruby-forum.com/.