Class: Phronomy::Runtime::ThreadScheduler Private

Inherits:
Scheduler
  • Object
show all
Defined in:
lib/phronomy/runtime/thread_scheduler.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Thread-based scheduler: spawns each task in a new OS thread.

This is the default scheduler used by Phronomy::Runtime in production. It delegates directly to Task.spawn with the default Task::ThreadBackend, preserving the pre-282 behaviour exactly.

Constant Summary

Constants inherited from Scheduler

Scheduler::SCHEDULER_KEY

Instance Method Summary collapse

Methods inherited from Scheduler

current, #new_signal, #raise_signal, #raise_signal_all, #wait_for_signal

Instance Method Details

#spawn(name:, parent:, &block) ⇒ Task

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Spawns +block+ as a new Task backed by a Thread.

Parameters:

  • name (String, nil)
  • parent (Task, nil)

Returns:



18
19
20
# File 'lib/phronomy/runtime/thread_scheduler.rb', line 18

def spawn(name:, parent:, &block)
  Task.spawn(name: name, parent: parent, &block)
end

#yieldvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Yields the current thread's time slice to other runnable threads.



25
26
27
# File 'lib/phronomy/runtime/thread_scheduler.rb', line 25

def yield
  Thread.pass
end