class Bunny::Concurrent::SynchronizedSortedSet
A SortedSet variation that synchronizes key mutation operations.
@note This is NOT a complete SortedSet replacement. It only synchronizes operations needed by Bunny. @api public
Public Class Methods
new(enum = nil)
click to toggle source
Calls superclass method
# File lib/bunny/concurrent/synchronized_sorted_set.rb, line 11 def initialize(enum = nil) @mutex = Mutex.new super end
Public Instance Methods
add(o)
click to toggle source
Calls superclass method
# File lib/bunny/concurrent/synchronized_sorted_set.rb, line 17 def add(o) # avoid using Mutex#synchronize because of a Ruby 1.8.7-specific # bug that prevents super from being called from within a block. MK. @mutex.lock begin super ensure @mutex.unlock end end
delete(o)
click to toggle source
Calls superclass method
# File lib/bunny/concurrent/synchronized_sorted_set.rb, line 28 def delete(o) @mutex.lock begin super ensure @mutex.unlock end end
delete_if(&block)
click to toggle source
Calls superclass method
# File lib/bunny/concurrent/synchronized_sorted_set.rb, line 37 def delete_if(&block) @mutex.lock begin super ensure @mutex.unlock end end
include?(o)
click to toggle source
Calls superclass method
# File lib/bunny/concurrent/synchronized_sorted_set.rb, line 46 def include?(o) @mutex.lock begin super ensure @mutex.unlock end end