From: Jam Bees Date: 2012-10-11T03:41:57+09:00 Subject: Re: Threads not concurrent Odd as it sounds, try printing to stderr and not stdout. Stdout is buffered and not reliable when trying to see thread output in real time. That may not get your current issue, but it'll be a good start. On 10 Oct 2012, at 01:37, ajay paswan wrote: > 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/. >