Module: EventMachine::Synchrony::AMQP

Defined in:
lib/em-synchrony/amqp.rb

Defined Under Namespace

Classes: Channel, Consumer, Error, Exchange, Queue, Session

Class Method Summary collapse

Class Method Details

.sync(&blk) ⇒ Object



14
15
16
17
18
# File 'lib/em-synchrony/amqp.rb', line 14

def sync &blk
  fiber = Fiber.current
  blk.call(fiber)
  Fiber.yield
end

.sync_cb(fiber) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/em-synchrony/amqp.rb', line 20

def sync_cb fiber
  lambda do |*args|
    if fiber == Fiber.current
      return *args
    else
      fiber.resume *args
    end
  end
end