class PriorityMutex::Waiter

Attributes

priority[RW]

Public Class Methods

new(priority) click to toggle source
# File lib/priority_mutex.rb, line 19
def initialize(priority)
  @priority = priority
  @queue = Queue.new
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/priority_mutex.rb, line 23
def <=>(other)
  self.priority <=> other.priority
end
resume() click to toggle source
# File lib/priority_mutex.rb, line 30
def resume
  @queue.enq :go
end
wait() click to toggle source
# File lib/priority_mutex.rb, line 26
def wait
  @queue.deq
  nil
end