vt::sched::BaseUnit struct

The base class for a work unit that either holds a std::unique_ptr to a runnable or contains a general lambda to execute.

Derived classes

struct PriorityUnit

Public types

using RunnablePtrType = runnable::RunnableNew*

Constructors, destructors, conversion operators

BaseUnit() defaulted
BaseUnit(bool in_is_term, RunnablePtrType in_r)
Construct with a runnable.
BaseUnit(bool in_is_term, ActionType in_work)
Construct with a general lambda.

Public functions

auto isTerm() const -> bool
Check if this work unit is a termination task.
void operator()()
Execute the work.
void execute()
Execute the work.

Protected variables

RunnablePtrType r_
ActionType work_
bool is_term_

Function documentation

vt::sched::BaseUnit::BaseUnit(bool in_is_term, RunnablePtrType in_r)

Construct with a runnable.

Parameters
in_is_term in whether it's a termination task
in_r in the runnable moved in

vt::sched::BaseUnit::BaseUnit(bool in_is_term, ActionType in_work)

Construct with a general lambda.

Parameters
in_is_term in whether it's a termination task
in_work in the action to execute

bool vt::sched::BaseUnit::isTerm() const

Check if this work unit is a termination task.

Returns whether it's a termination task

Variable documentation

RunnablePtrType vt::sched::BaseUnit::r_ protected

the runnable task

ActionType vt::sched::BaseUnit::work_ protected

the lambda task

bool vt::sched::BaseUnit::is_term_ protected

whether it's a termination task