るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.078秒)
トップページ > クエリ:_builtin[x] > クエリ:new[x] > クエリ:priority=[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Thread#priority=(val) (23124.0)

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

...//emlist[例][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 # =>...

Thread#priority -> Integer (8024.0)

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

...//emlist[例][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 # =>...