0
我正在尋找如何在jruby中正確啓動兩個簡單的線程。Simple jruby線程
在以下兩個線程中,第一個線程中的消息不會被打印。我可以換兩個線程和行爲(第一個線程不打印)仍然存在:所以它不是關於線程的內容(這是我在任何情況下,掐滅)
input_before_mysql_phases_t = Thread.new do
sprint "input_before_mysql_phases completed"
end
mysql_phases_t = Thread.new do
sprint "mysql_phases completed"
end
sprint "awaiting completion of data fetch phases .."
sleep 5
sprint "data fetch phases completed"
這裏是輸出:注意來自第一個線程的消息不會被打印。
=> #<Thread:0x72d006a7 run>
[2013-04-18T12:56:29+00:00] SCHEDULER: mysql_phases completed
irb(main):540:0> sprint "awaiting completion of data fetch phases .."
[2013-04-18T12:56:29+00:00] SCHEDULER: awaiting completion of data fetch phases ..
=> nil
irb(main):541:0> sleep 5
=> 5
irb(main):542:0> sprint "data fetch phases completed"
[2013-04-18T12:56:34+00:00] SCHEDULER: data fetch phases completed