Queue

Queue

ri

 ----------------------------------------------------------- Class: Queue
      This class provides a way to synchronize communication between
      threads.
 
      Example:
 
        require 'thread'
      
        queue = Queue.new
      
        producer = Thread.new do
          5.times do |i|
            sleep rand(i) # simulate expense
            queue << i
            puts "#{i} produced"
          end
        end
      
        consumer = Thread.new do
          5.times do |i|
            value = queue.pop
            sleep rand(i/2) # simulate expense
            puts "consumed #{value}"
          end
        end
      
        consumer.join
 
 ------------------------------------------------------------------------
 
 
 Class methods:
 --------------
      new
 
 
 Instance methods:
 -----------------
      <<, clear, deq, empty?, enq, length, num_waiting, pop, push, shift,
      size

refe

 ==== Queue ====
 Queueスレッド間のFIFO(first in first out)の通信路です。ス
 レッドが空のqueueを読み出そうとすると停止します。queueになんら
 かの情報が書き込まれると実行は再開されます。
 ---- Singleton methods ----
 new
 ---- Instance methods ----
 << clear deq empty? enq length num_waiting pop push shift
 size
 ---- Singleton methods (inherited) ----
 ---- Instance methods (inherited) ----
 == === =~ __id__ __send__ _dump _load class clone display
 dup eql? equal? extend freeze frozen? hash id initialize
 initialize_copy inspect instance_eval instance_of?
 instance_variable_get instance_variable_set
 instance_variables is_a? kind_of? marshal_dump marshal_load
 method method_missing methods nil? object_id pretty_print
 pretty_print_cycle pretty_print_instance_variables
 private_methods protected_methods public_methods
 remove_instance_variable respond_to? send
 singleton_method_added singleton_method_removed
 singleton_method_undefined singleton_methods taint tainted?
 to_a to_ary to_hash to_int to_s to_str type untaint

  • 2006/05/12 19:52:48 <
  • 2006/05/12 19:52:55 <<
  • 2006/05/15 12:08:19 clear
  • 2006/05/15 12:17:09 empty?
  • 2006/05/15 12:37:17 length
  • 2006/05/15 12:42:14 new
  • 2006/05/15 12:46:09 pop
  • 2006/05/15 12:48:41 push
  • 2006/05/12 20:36:41 Queue
  • 2006/05/15 12:56:06 shift
  • 2006/05/15 12:56:40 size
  • 2006/05/15 11:47:48 SizedQueue
  • 2006/05/15 13:11:55 wait
  • 2006/05/15 11:59:52 ^