Project

General

Profile

Feature #6293

new queue / blocking queues

Added by tenderlovemaking (Aaron Patterson) over 8 years ago. Updated over 2 years ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:44349]

Description

Hi,

I'd like to add new Queue objects to ruby. Whenever I use queues, I either use them in a blocking or non-blocking manner only, so I have separated them in to two classes Thread::Queue, and Thread::BlockingQueue.

Other notable differences, these queues:

  • implement poll, which will return a nil if the queue is empty
  • do not allow nil to be in the queue as it would interfere with poll
  • include Enumerable

I think these will be a good basis for implementing a Deque, SynchronizedQueue, and PriorityQueue.

I've attached a patch against trunk.


Files

queue.patch (11.6 KB) queue.patch tenderlovemaking (Aaron Patterson), 04/14/2012 08:28 AM
noname (500 Bytes) noname Anonymous, 04/14/2012 11:23 AM
noname (500 Bytes) noname Anonymous, 04/14/2012 11:29 AM
noname (500 Bytes) noname Anonymous, 04/17/2012 12:29 AM
queue.patch (11.4 KB) queue.patch Anonymous, 04/21/2012 07:59 AM
noname (500 Bytes) noname Anonymous, 04/21/2012 07:59 AM

Also available in: Atom PDF