Class: Hitimes::MutexedStats
- Inherits:
-
Stats
- Object
- Object
- Stats
- Hitimes::MutexedStats
- Defined in:
- lib/hitimes/mutexed_stats.rb
Overview
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.
Constant Summary
Constant Summary
Constants inherited from Stats
Instance Method Summary (collapse)
-
- (MutexedStats) initialize
constructor
A new instance of MutexedStats.
-
- (Object) update(value)
call-seq:.
Methods inherited from Stats
#count, #max, #mean, #min, #rate, #stddev, #sum, #sumsq, #to_hash, #to_json
Constructor Details
- (MutexedStats) initialize
A new instance of MutexedStats
15 16 17 |
# File 'lib/hitimes/mutexed_stats.rb', line 15 def initialize @mutex = Mutex.new end |
Instance Method Details
- (Object) update(value)
call-seq:
mutex_stat.update( val ) -> nil
Update the running stats with the new value in a threadsafe manner.
24 25 26 27 28 |
# File 'lib/hitimes/mutexed_stats.rb', line 24 def update( value ) @mutex.synchronize do super( value ) end end |