| Server IP : 162.214.74.102 / Your IP : 216.73.217.21 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Queue/ |
Upload File : |
U:RDoc::NormalClass[iI"
Queue:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I"GThe Queue class implements multi-producer, multi-consumer queues. ;TI"FIt is especially useful in threaded programming when information ;TI"Hmust be exchanged safely between multiple threads. The Queue class ;TI"3implements all the required locking semantics.;To:RDoc::Markup::BlankLine o; ;[I"IThe class implements FIFO type of queue. In a FIFO queue, the first ;TI")tasks added are the first retrieved.;T@o; ;[I"
Example:;T@o:RDoc::Markup::Verbatim;[I"require 'thread'
;TI"queue = Queue.new
;TI"
;TI"producer = Thread.new do
;TI" 5.times do |i|
;TI"+ sleep rand(i) # simulate expense
;TI" queue << i
;TI" puts "#{i} produced"
;TI" end
;TI" end
;TI"
;TI"consumer = Thread.new do
;TI" 5.times do |i|
;TI" value = queue.pop
;TI"- sleep rand(i/2) # simulate expense
;TI"# puts "consumed #{value}"
;TI" end
;TI"end;T:@format0:
@fileI"thread_sync.c;T:0@omit_headings_from_table_of_contents_below0;
0;0[ [ [ [[I"
class;T[[:public[[I"new;TI"thread_sync.c;T[:protected[ [:private[ [I"
instance;T[[;[[I"<<;T@;[I"
clear;T@;[I"
close;T@;[I"closed?;T@;[I"deq;T@;[I"empty?;T@;[I"enq;T@;[I"length;T@;[I"num_waiting;T@;[I"pop;T@;[I" push;T@;[I"
shift;T@;[I" size;T@;[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;
0;0[@/@/cRDoc::TopLevel