0
我正在使用內部具有常量循環的線程。我想檢查線程睡眠的時間。如何在紅寶石中找到睡眠線程的時間?
如何找到線程的休眠時間?
這裏是代碼
t = Thread.new{
loop do
puts "thread "
threads=Thread.list
threads.each_with_index do |th,index|
th.status == "run" ? th.priority = 2 : th.priority = 0
if th.status == "false" || th.status == "sleep"
th.kill
end
print "thread #{th} : State=> #{th.status} : priority=> #{th.priority} :index=> #{index} \n "
end
end
}
我想知道休眠線程的時間,這樣我可以殺正確的。由於螺紋的生活應該在某個階段被殺害