Module: Redistat::Synchronize::InstanceMethods

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

Overview

<< self

Instance Method Summary collapse

Instance Method Details

#monitorObject



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

def monitor
  Synchronize.monitor
end

#synchronize(&block) ⇒ Object



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

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

#thread_safeObject



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

def thread_safe
  Synchronize.thread_safe
end

#thread_safe=(value) ⇒ Object



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

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