Method: Green::Mutex#lock

Defined in:
lib/green/semaphore.rb

#lockObject



80
81
82
83
84
85
86
87
# File 'lib/green/semaphore.rb', line 80

def lock
  if Green.current.locals["mutex_locked_#{self.object_id}"]
    Green.current.locals.delete "mutex_locked_#{self.object_id}"
    raise Green::GreenError.new
  end
  Green.current.locals["mutex_locked_#{self.object_id}"] = true
  acquire
end