From: jonathanscruz@... Date: 2015-09-09T15:03:33+00:00 Subject: [ruby-core:70701] [Ruby trunk - Feature #11517] [Open] Queue enhancement - conditional pop Issue #11517 has been reported by Jonathan Cruz. ---------------------------------------- Feature #11517: Queue enhancement - conditional pop https://bugs.ruby-lang.org/issues/11517 * Author: Jonathan Cruz * Status: Open * Priority: Normal * Assignee: Yukihiro Matsumoto ---------------------------------------- I���m submitting a patch to enhance Queue#pop. This allows the caller to provide a block that accepts data from the queue. Queue#pop will return the first element for which the block returns a truthy value, and remove it from the queue. Without a block, Queue#pop will behave the same way it currently does. The motivation for this enhancement: On our project, we have a queue of work and several worker threads. Some work can incur a heavy load on the system and should not be processed while another worker is processing 'heavy load' work. We need a way for Queue#pop to skip over heavy load items while another thread is processing heavy load work. ---Files-------------------------------- ruby_queue_conditional_pop.patch (3.76 KB) -- https://bugs.ruby-lang.org/