Class: ThreadsafeSequenceLoop

Inherits:
ThreadsafeSequence show all
Defined in:
lib/ruby-threading-toolkit/threadsafe_sequence_loop.rb

Instance Method Summary collapse

Methods inherited from ThreadsafeSequence

#initialize

Constructor Details

This class inherits a constructor from ThreadsafeSequence

Instance Method Details

#nextvalObject



18
19
20
21
22
23
# File 'lib/ruby-threading-toolkit/threadsafe_sequence_loop.rb', line 18

def nextval
  @mutex.synchronize do
    @value = @initial_value if @value == @maximum
    @value += 1
  end
end