るりまサーチ

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

別のキーワード

  1. drb thread
  2. thread exit
  3. thread kill
  4. thread join
  5. etc sc_thread_threads_max

ライブラリ

クラス

キーワード

検索結果

Thread::Queue#close -> self (27230.0)

キューを close します。close 済みのキューを再度 open することはできません。

...キューを close します。close 済みのキューを再度 open することはできません。

close
後は以下のように動作します。

* Thread::Queue#closed? は true を返します
* Thread::Queue#close は無視されます
* Thread::Queue#enq/push/<< は ClosedQueueError...
...* Thread::Queue#empty? が false を返す場合は Thread::Queue#deq/pop/shift は通常通りオブジェクトを返します

また、ClosedQueueError は StopIteration を継承しているため、
close
する事でループから脱出する事もできます。

例:

q = Queue.new
T
h...
...read.new{
while e = q.deq # wait for nil to break loop
# ...
end
}
q.close...

Thread::SizedQueue#close -> self (27202.0)

キューを close します。詳しくは Thread::Queue#close を参照してください。

...ーを close します。詳しくは Thread::Queue#close を参照してください。

Thread
::Queue とはキューにオブジェクトを追加するスレッドの動作が
異なります。キューにオブジェクトを追加するスレッドを待機している場合は
Close
dQueueErr...
...or が発生して中断されます。

//emlist[例][ruby]{
q = SizedQueue.new(4)

[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }

q.closed? # => false
q.close
q.closed? # => true
//}

@see Thread::Queue#close...

ThreadGroup#enclose -> self (15173.0)

自身への ThreadGroup#add によるスレッドの追加・削除を禁止します。 enclose された ThreadGroup に追加や削除を行うと例外 ThreadError が発生します。

...自身への ThreadGroup#add によるスレッドの追加・削除を禁止します。
enclose された ThreadGroup に追加や削除を行うと例外 ThreadError が発生します。

ただし、Thread.new によるスレッドの追加は禁止されません。enclose されたスレッ...
...:

t
hg = ThreadGroup.new.enclose
t
hg.add Thread.new {}

=> -:2:in `add': can't move to the enclosed thread group (ThreadError)

削除の例:

t
hg1 = ThreadGroup.new
t
hg2 = ThreadGroup.new

t
h = Thread.new {sleep 1}

t
hg1.add th
t
hg1.enclose
t
hg2.add th

=> -:8:in `add': can't mo...
...ve from the enclosed thread group (ThreadError)...

Thread::Queue#closed? -> bool (15123.0)

キューが close されている時に true を返します。

...キューが close されている時に true を返します。

//emlist[例][ruby]{
q = Queue.new

[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }

q.closed? # => false
q.close
q.closed? # => true
//}...

ThreadGroup#enclosed? -> bool (15113.0)

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

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

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

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

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

@see ThreadGroup#enclose...

絞り込み条件を変える