RAA - priorityqueue

priorityqueue / 0.1a

Short description: A queue with priority based on the class the objects belong to
Category: Library/thread
Status: Fully usable
Created: 2003-06-21 15:32:55 GMT
Last update: 2003-06-21 15:32:53 GMT
Owner: Zifro (Projects of this owner)
Homepage: http://hazzard.info/zifro/ruby/
Download: http://hazzard.info/zifro/ruby/priorityqueue.rb
License: Ruby's
Dependency:
None
Description:

The PriorityQueue class allows you to make threads communicate, as the Queue class does. But with this one, you specify at creation time the classes of the objects you'll push and pop in this queue, and in which order they'll be popped.
For example, you want thread A send thread B NormalMessages and UrgentMessages. Create your queue as this :
q = PriorityQueue::new('UrgentMessage', 'NormalMessage')
Push your objects as usually, but when you'll pop them, all the UrgentMessages will be shifted before the NormalMessages ones.

Edit this project (for project owner)

back to RAA top