Module: Redistat::Synchronize::InstanceMethods

Defined in:
lib/redistat/mixins/synchronize.rb

Overview

<< self

Instance Method Summary collapse

Instance Method Details

#monitorObject



38
39
40
# File 'lib/redistat/mixins/synchronize.rb', line 38

def monitor
  Synchronize.monitor
end

#synchronize(&block) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/redistat/mixins/synchronize.rb', line 42

def synchronize(&block)
  if thread_safe
    monitor.synchronize(&block)
  else
    block.call
  end
end

#thread_safeObject



30
31
32
# File 'lib/redistat/mixins/synchronize.rb', line 30

def thread_safe
  Synchronize.thread_safe
end

#thread_safe=(value) ⇒ Object



34
35
36
# File 'lib/redistat/mixins/synchronize.rb', line 34

def thread_safe=(value)
  Synchronize.thread_safe = value
end