Ruby/Threads/alive
Материал из Wiki.crossplatform.ru
Версия от 18:00, 13 сентября 2010; ViGOur (Обсуждение | вклад)
Is it still alive, stopped
count = 0 t1 = Thread.new { loop { count += 1 } } t2 = Thread.new { Thread.stop } sleep 1 puts t1.alive? # true puts t1.stop? # false puts t2.alive? # true puts t2.stop? # true