るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.095秒)

別のキーワード

  1. socket so_priority
  2. etc sc_priority_scheduling
  3. etc sc_thread_priority_scheduling
  4. srv priority
  5. thread priority=

ライブラリ

クラス

検索結果

Thread#priority=(val) (15113.0)

スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。

...][ruby]{
Thread.current.priority # => 0

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
count1 = count2 = 0 # reset
sleep 1 # => 1
count1 # => 13809431
count2 # => 11571921
//}...

Thread#priority -> Integer (13.0)

スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。

...][ruby]{
Thread.current.priority # => 0

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
count1 = count2 = 0 # reset
sleep 1 # => 1
count1 # => 13809431
count2 # => 11571921
//}...