How to make two threads do something in turn, i.e., A => B => A => B
....?

I know the code below is not correct, but I do not know how to make it
correct. Could anybody help?

=======================================
mutex=Mutex.new

t=Thread.new {
  while true
    Thread.stop
    puts "B move..."
    Thread.main.wakeup
  end
}

while true
  puts "A move..."
  t.wakeup
  Thread.stop
end

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