Module: Redistat::Synchronize

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

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/redistat/mixins/synchronize.rb', line 7

def included(base)
  base.send(:include, InstanceMethods)
end

.monitorObject



11
12
13
# File 'lib/redistat/mixins/synchronize.rb', line 11

def monitor
  @monitor ||= Monitor.new
end

.thread_safeObject



15
16
17
18
19
20
# File 'lib/redistat/mixins/synchronize.rb', line 15

def thread_safe
  monitor.synchronize do
    return @thread_safe unless @thread_safe.nil?
    @thread_safe = false
  end
end

.thread_safe=(value) ⇒ Object



22
23
24
25
26
# File 'lib/redistat/mixins/synchronize.rb', line 22

def thread_safe=(value)
  monitor.synchronize do
    @thread_safe = value
  end
end