Module: ProcessShared::MonitorMixin

Defined in:
lib/process_shared/monitor_mixin.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(obj) ⇒ Object



5
6
7
# File 'lib/process_shared/monitor_mixin.rb', line 5

def self.extended(obj)
  obj.send :mon_initialize
end

Instance Method Details

#mon_enterObject



9
10
11
# File 'lib/process_shared/monitor_mixin.rb', line 9

def mon_enter
  @mon_monitor.lock
end

#mon_exitObject



13
14
15
# File 'lib/process_shared/monitor_mixin.rb', line 13

def mon_exit
  @mon_monitor.unlock
end

#mon_synchronizeObject Also known as: synchronize



17
18
19
20
21
22
23
24
# File 'lib/process_shared/monitor_mixin.rb', line 17

def mon_synchronize
  mon_enter
  begin
    yield
  ensure
    mon_exit
  end
end

#mon_try_enterObject Also known as: try_mon_enter

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/process_shared/monitor_mixin.rb', line 27

def mon_try_enter
  raise NotImplementedError, 'not implemented'
end

#new_condObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/process_shared/monitor_mixin.rb', line 32

def new_cond
  raise NotImplementedError, 'not implemented'
end