class Eventbox::ActionCallContext

Attributes

action[R]

The action that drives the call context.

Public Class Methods

new(event_loop) click to toggle source

@private

# File lib/eventbox/call_context.rb, line 22
def initialize(event_loop)
  answer_queue = Queue.new
  meth = proc do
    event_loop.callback_loop(answer_queue, nil, self.class)
  end
  @action = event_loop.start_action(meth, self.class, [])

  def answer_queue.gc_stop(object_id)
    close
  end
  ObjectSpace.define_finalizer(self, answer_queue.method(:gc_stop))

  @__answer_queue__ = answer_queue
end

Public Instance Methods

shutdown!() click to toggle source

Terminate the call context and the driving action.

The method returns immediately and the corresponding action is terminated asynchonously.

# File lib/eventbox/call_context.rb, line 43
def shutdown!
  @__answer_queue__.close
end