Class: L2meter::ThreadSafe

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/l2meter/thread_safe.rb

Overview

This class is a wrapper around Emitter that makes sure that we have a completely separate clone of Emitter per thread running. It doesn’t truly make Emitter thread-safe, it makes sure that you don’t access the same instance of emitter from different threads.

Instance Method Summary collapse

Constructor Details

#initialize(emitter) ⇒ ThreadSafe

Returns a new instance of ThreadSafe.



25
26
27
# File 'lib/l2meter/thread_safe.rb', line 25

def initialize(emitter)
  @emitter = emitter.freeze
end

Instance Method Details

#disable!Object



31
32
33
# File 'lib/l2meter/thread_safe.rb', line 31

def disable!
  @disabled = true
end