Hi my code looks like:
================few lines of codes
childredn=[]
for i in 1..2
  children[i-1]=Thread.new do
    DRb.start_service
    server_uri=ARGV.shift
    server = DRbObject.new nil, server_uri
    puts "A new thread created----------------------"
    while !server.get_stop_flag
      sleep(i)
      puts "inside loop----------------------"
      begin
        obj=server.get_object_s
        if !(Obj===obj and obj!=nil)
          sleep(6)
          next
        end
        process=Process.new(obj)
        process.process_on()
        processed_obj=process.obj
        server.update_obj(processed_obj)
      rescue => e
        $logger.log_it("Error in client, ", e.message)
      end
    end
    puts "--A thread completed"
  end
end

children.each do |t|
  if t!=nil
    t.join
  end
end
================few lines of codes

#---------------
The sequence of print is like:
puts "A new thread created----------------------"
puts "A new thread created----------------------"
--A thread completed
puts "inside loop----------------------"
--A thread completed

But I want:
puts "A new thread created----------------------"
puts "A new thread created----------------------"
puts "inside loop----------------------"
--A thread completed
--A thread completed

-- 
Posted via http://www.ruby-forum.com/.