method

priority=

v1_8_6_287 - Show latest stable - Class: Thread
priority=(p1)
public

Sets the priority of thr to integer. Higher-priority threads will run before lower-priority threads.

   count1 = count2 = 0
   a = Thread.new do
         loop { count1 += 1 }
       end
   a.priority = -1

   b = Thread.new do
         loop { count2 += 1 }
       end
   b.priority = -2
   sleep 1   #=> 1
   Thread.critical = 1
   count1    #=> 622504
   count2    #=> 5832