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
# File 'lib/redistat/mixins/synchronize.rb', line 15

def thread_safe
  monitor.synchronize do
    @thread_safe ||= false
  end
end

.thread_safe=(value) ⇒ Object



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

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