module PIM::ExecutionGuard

Per-execute wall-clock deadline stack on Thread.current. Nested same-thread executes push/pop frames; only the top frame may raise into the worker.

Constants

STACK_KEY

Public Instance Methods

pop_and_stop(thread = Thread.current) click to toggle source
# File pim.rb, line 849
def pop_and_stop(thread = Thread.current)
  frames = thread[STACK_KEY]
  return if frames.nil? || frames.empty?

  frame = frames.pop
  frame.stop
  frames.last.signal_changed if frames.last
  thread[STACK_KEY] = nil if frames.empty?
  frame
end
push(frame) click to toggle source
# File pim.rb, line 844
def push(frame)
  stack(frame.worker).push(frame)
  frame
end
stack(thread = Thread.current) click to toggle source
# File pim.rb, line 831
def stack(thread = Thread.current)
  thread[STACK_KEY] ||= []
end
top(thread = Thread.current) click to toggle source
# File pim.rb, line 835
def top(thread = Thread.current)
  frames = thread[STACK_KEY]
  frames.nil? ? nil : frames.last
end
top?(frame) click to toggle source
# File pim.rb, line 840
def top?(frame)
  top(frame.worker).equal?(frame)
end