Class: FiberMon::RBFiberMon::Monitor

Inherits:
Monitor
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/fiber-mon.rb

Instance Method Summary collapse

Constructor Details

#initialize(fibmon) ⇒ Monitor

Returns a new instance of Monitor.



167
168
169
170
# File 'lib/fiber-mon.rb', line 167

def initialize(fibmon)
  super()
  @fibmon = fibmon
end

Instance Method Details

#fiber_yieldObject Also known as: yield



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/fiber-mon.rb', line 179

def fiber_yield
  begin
    mon_check_owner
  rescue
    return Fiber.yield
  end
  if (count = mon_exit_for_cond) > 0
    begin
      Fiber.yield @mon_mutex
    ensure
      @mon_mutex.lock
    end
  else
    Fiber.yield
  end
  mon_enter_for_cond(count)
end

#new_cvObject



175
176
177
# File 'lib/fiber-mon.rb', line 175

def new_cv
  ConditionVariable.new(self)
end