Class: Blocker

Inherits:
Object show all
Defined in:
lib/stratagem/blocker.rb

Instance Method Summary collapse

Constructor Details

#initializeBlocker

Returns a new instance of Blocker.



4
5
6
7
# File 'lib/stratagem/blocker.rb', line 4

def initialize
  @mutex = Mutex.new
  @cv = ConditionVariable.new
end

Instance Method Details

#notifyObject



13
14
15
# File 'lib/stratagem/blocker.rb', line 13

def notify
  @mutex.synchronize { @cv.signal }
end

#waitObject



9
10
11
# File 'lib/stratagem/blocker.rb', line 9

def wait
  @mutex.synchronize { @cv.wait(@mutex) }
end