D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Thread
/
Queue
/
Filename :
close-i.ri
back
Copy
U:RDoc::AnyMethod[iI" close:ETI"Thread::Queue#close;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I":Closes the queue. A closed queue cannot be re-opened.;To:RDoc::Markup::BlankLine o; ; [I"?After the call to close completes, the following are true:;T@o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0; [o; ; [I"+closed?+ will return true;T@o;;0; [o; ; [I"+close+ will be ignored.;T@o;;0; [o; ; [I"9calling enq/push/<< will raise a +ClosedQueueError+.;T@o;;0; [o; ; [I"Iwhen +empty?+ is false, calling deq/pop/shift will return an object ;TI"from the queue as usual.;To;;0; [o; ; [I"Xwhen +empty?+ is true, deq(false) will not suspend the thread and will return nil. ;TI"*deq(true) will raise a +ThreadError+.;T@o; ; [I"XClosedQueueError is inherited from StopIteration, so that you can break loop block.;T@o; ; [I" Example:;T@o:RDoc::Markup::Verbatim; [I"q = Thread::Queue.new ;TI"Thread.new{ ;TI"4 while e = q.deq # wait for nil to break loop ;TI" # ... ;TI" end ;TI"} ;TI"q.close;T:@format0: @fileI"thread_sync.c;T:0@omit_headings_from_table_of_contents_below0I"close ;T0[ I"();T@>FI" Queue;TcRDoc::NormalClass00