The OpenD Programming Language

ThreadScheduler

An example Scheduler using kernel threads.

This is an example Scheduler that mirrors the default scheduling behavior of creating one kernel thread per call to spawn. It is fully functional and may be instantiated and used, but is not a necessary part of the default functioning of this module.

Members

Functions

newCondition
Condition newCondition(Mutex m)

Creates a new Condition variable. No custom behavior is needed here.

spawn
void spawn(void delegate() op)

Creates a new kernel thread and assigns it to run the supplied op.

start
void start(void delegate() op)

This simply runs op directly, since no real scheduling is needed by this approach.

yield
void yield()

This scheduler does no explicit multiplexing, so this is a no-op.

Properties

thisInfo
ThreadInfo thisInfo [@property getter]

Returns ThreadInfo.thisInfo, since it is a thread-local instance of ThreadInfo, which is the correct behavior for this scheduler.

Inherited Members

From Scheduler

start
void start(void delegate() op)

Spawns the supplied op and starts the Scheduler.

spawn
void spawn(void delegate() op)

Assigns a logical thread to execute the supplied op.

yield
void yield()

Yields execution to another logical thread.

thisInfo
ThreadInfo thisInfo [@property getter]

Returns an appropriate ThreadInfo instance.

newCondition
Condition newCondition(Mutex m)

Creates a Condition variable analog for signaling.

Meta