るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.072秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:@[x] > クエリ:@[x] > クラス:ThreadGroup[x]

キーワード

検索結果

ThreadGroup#add(thread) -> self (27.0)

スレッド thread が属するグループを自身に変更します。

...ープを自身に変更します。

@
param thread 自身に加えたいスレッドを指定します。

@
raise ThreadError 自身が freeze されているか enclose されている場合に、発生します。また引数 thread が属する ThreadGroup が freeze されているか enclose...
...{ThreadGroup::Default.list}"
# => Initial group is [#<Thread:0x4a49168 run>]

tg = ThreadGroup.new
t1 = Thread.new { sleep }
t2 = Thread.new { sleep }
puts "t1 is #{t1}" # => t1 is #<Thread:0x50bef60>
puts "t2 is #{t2}" # => t2 is #<Thread:0x50beed0>
tg.add(t1)
puts "Initial group now #{ThreadGroup:...

ThreadGroup#enclosed? -> bool (15.0)

自身が enclose されているなら true を返します。そうでないなら false を返します。デフォルトは false です。

...す。

freeze された ThreadGroup には Thread の追加/削除ができませんが、enclosed? は false を返します。

thg = ThreadGroup.new
p thg.enclosed? # => false
thg.enclose
p thg.enclosed? # => true

thg = ThreadGroup.new
p thg.enclosed?...
...# => false
thg.freeze
p thg.enclosed? # => false

@
see ThreadGroup#enclose...