class Hitimes::MutexedStats

MutexedStats is the start of a threadsafe Stats class. Currently, on MRI Ruby the Stats object is already threadsafe, so there is no need to use MutexedStats.

Public Class Methods

new() click to toggle source
# File lib/hitimes/mutexed_stats.rb, line 15
def initialize
  @mutex = Mutex.new
end

Public Instance Methods

update( val ) → nil click to toggle source

Update the running stats with the new value in a threadsafe manner.

Calls superclass method Hitimes::Stats#update
# File lib/hitimes/mutexed_stats.rb, line 24
def update( value )
  @mutex.synchronize do
    super( value )
  end
end