Class: Proc
- Defined in:
- lib/fOOrth/library/fiber_library.rb,
lib/fOOrth/library/procedure_library.rb
Overview
A helper method in the Proc class for fOOrth threads.
Instance Method Summary collapse
-
#do_thread_start(vm, vm_name) ⇒ Object
Do the mechanics of starting a thread.
-
#to_foorth_fiber ⇒ Object
Convert this procedure to a fiber.
Instance Method Details
#do_thread_start(vm, vm_name) ⇒ Object
Do the mechanics of starting a thread.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fOOrth/library/procedure_library.rb', line 47 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 ⇒ Object
Convert this procedure to a fiber.
120 121 122 |
# File 'lib/fOOrth/library/fiber_library.rb', line 120 def to_foorth_fiber XfOOrth::XfOOrth_Fiber.new(&self) end |