るりまサーチ

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

別のキーワード

  1. _builtin deq
  2. queue deq
  3. sizedqueue deq
  4. thread deq
  5. deq threaderror

ライブラリ

クラス

検索結果

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

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

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

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

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

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

例:

q = Queue.new
Thread.new{
while e = q.deq # wait for nil to b...
...reak loop
# ...
end
}
q.close...