class Dynflow::Semaphores::Abstract
Public Instance Methods
drain()
click to toggle source
Requests all tickets Returns all free tickets from the semaphore
# File lib/dynflow/semaphores/abstract.rb, line 41 def drain raise NotImplementedError end
get(n = 1)
click to toggle source
Tries to get n tickets Returns n if the semaphore has free >= n Returns free if n > free
# File lib/dynflow/semaphores/abstract.rb, line 35 def get(n = 1) raise NotImplementedErrorn end
get_waiting()
click to toggle source
Gets first object from the queue
# File lib/dynflow/semaphores/abstract.rb, line 13 def get_waiting raise NotImplementedError end
has_waiting?()
click to toggle source
Checks if there are objects in the queue
# File lib/dynflow/semaphores/abstract.rb, line 18 def has_waiting? raise NotImpelementedError end
release(n = 1)
click to toggle source
Returns n tickets to the semaphore
# File lib/dynflow/semaphores/abstract.rb, line 23 def release(n = 1) raise NotImplementedError end
save()
click to toggle source
Saves the semaphore's state to some persistent storage
# File lib/dynflow/semaphores/abstract.rb, line 28 def save raise NotImplementedError end
wait(thing)
click to toggle source
Tries to get ticket from the semaphore Returns true if thing got a ticket Rturns false otherwise and puts the thing into the semaphore's queue
# File lib/dynflow/semaphores/abstract.rb, line 8 def wait(thing) raise NotImplementedError end