Project
improved-queue
A simple elaboration on Ruby's native SizedQueue which allows using the queue
object to re-awaken a blocked thread and cause it to abandon its blocking
enqueue/dequeue operation. Useful for simplifying program logic, reducing the
need for external flags/Muteces (yes, I said Muteces), and for cleanly
resolving queues on program termination without risk of data loss or deadlock.
Why use this queue? There are two reasons. For one thing, under several
circumstances it is _considerably_ faster than Ruby's native SizedQueue. I
admit I'm not entirely sure why, but I have tested this on multiple platforms
and it seems to hold true as a generality. You can feel free to confirm or
dispel that this advantage holds for your use case at your own leisure.
The second reason is the aforementioned simplification of program logic.
In the case that all data passing through the queues must be preserved on
program termination, SizedQueue can require some elaborate trickery to ensure
that even the most remote possibility of deadlock is removed.
ImprovedSizedQueue solves this problem by making it possible to use the queue
to pass control messages between threads, irrespective of the queue's actual
content.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
Development
Licenses
GPL v3
Dependencies