hi
please consider the below program,

@i=0;@j=0
def hi
  hello
  while(@i<10)
    puts 'hi'
    @i+=1
  end
end
def hello
Thread.new do
  while(@j<10)
    puts 'hello'
    @j+=1
  end
end
end
hi #function call

Output

hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hi
hi
hi
hi
hi
hi
hi
hi
hi
hi

Now my question is I introduce the thread inside the hello function but
it hasn't run my file parallelly instead execution goes sequentially.
What to do to run this both the function parallelly ? The output might
be like below

hello
hi
hello
hi
...
...

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