| Class | Moneta::Semaphore |
| In: |
lib/moneta/synchronize.rb
|
| Parent: | SynchronizePrimitive |
Distributed/shared store-wide semaphore
@example Use `Moneta::Semaphore`
semaphore = Moneta::Semaphore.new(store, 'semaphore', 2)
semaphore.synchronize do
# Synchronized access
# ...
end
@api public
@param [Moneta store] store The store we want to lock @param [Object] counter Key of the counter entry @param [Fixnum] max Maximum number of threads which are allowed to enter the critical section