るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.017秒)
トップページ > クエリ:count[x] > クラス:Thread[x]

別のキーワード

  1. _builtin count
  2. array count
  3. enumerable count
  4. rubygems/user_interaction count
  5. matrix row_count

ライブラリ

キーワード

検索結果

Thread#priority -> Integer (49.0)

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

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

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

b = Thread.new do
loop { count2 += 1 }
end
b.priority = -2
count
1 = count2 = 0 # reset
sleep 1 # => 1
count
1 # => 13809431
count
2 # => 115719...

Thread#priority=(val) (49.0)

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

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

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

b = Thread.new do
loop { count2 += 1 }
end
b.priority = -2
count
1 = count2 = 0 # reset
sleep 1 # => 1
count
1 # => 13809431
count
2 # => 115719...