class Proc

Monkey patch Procedure to support fibers.

A helper method in the Proc class for fOOrth threads.

Public Instance Methods

do_thread_start(vm, vm_name) click to toggle source

Do the mechanics of starting a thread.

# File lib/fOOrth/library/procedure_library.rb, line 51
def do_thread_start(vm, vm_name)
  block, interlock = self, Queue.new

  result = Thread.new(vm.foorth_copy(vm_name)) do |vm_copy|

    begin
      self.foorth_init(vm_copy.compiler_reset.connect_vm_to_thread)
    ensure
      interlock.push(:ready)
    end

    vm_copy.instance_exec(vm_copy, &block)
  end

  interlock.pop
  result
end
to_foorth_fiber() click to toggle source

Convert this procedure to a fiber.

# File lib/fOOrth/library/fiber_library.rb, line 120
def to_foorth_fiber
  XfOOrth::XfOOrth_Fiber.new(&self)
end