Skip to content

Yield function for schedulers #12

@Aidan63

Description

@Aidan63

It seems like most OS' and event loops have yielding be a bit more involved than just "bounce through the scheduler", e.g.

Win32 (Sleep)

A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.

Linux (sched_yield)

If the calling thread is the only thread in the highest priority list at that time, it will continue to run after a call to sched_yield().

WxWidgets Event Loop (wxEventLoopBase::Yield(bool onlyIfNeeded = false))

Yields control to pending messages in the windowing system.

If someone was creating a custom scheduler and wanted functionality like this they could just treat scheduling with a time of zero as a yield, but maybe it makes sense to have a abstract yield function on the scheduler?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions