What is your priority : priority « Threads « Ruby





What is your priority


t1 = Thread.new { loop { sleep 1 } }
t2 = Thread.new { loop { sleep 1 } }
t2.priority = 3    # Set t2 at priority 3
p1 = t1.priority   # 0
p2 = t2.priority   # 3

 

Related examples in the same category

1.Thread Priority