Class Scheduler

Class Documentation

class Scheduler

Public Functions

explicit Scheduler(Environment *env)
~Scheduler()
void schedule_sync(BaseAction *action, const Tag &tag)
auto schedule_async(BaseAction *action, const Duration &delay) -> Tag
inline auto lock() noexcept -> auto
void set_port(BasePort *port)
inline auto logical_time() const noexcept -> const auto&
void start()
void stop()

Public Members

friend Worker

Private Functions

void fill_action_list_pool()
void schedule() noexcept
auto schedule_ready_reactions() -> bool
void next()
void terminate_all_workers()
void set_port_helper(BasePort *port)

Private Members

const bool using_workers_
LogicalTime logical_time_ = {}
Environment *environment_
std::vector<Worker> workers_ = {}
std::mutex scheduling_mutex_
std::condition_variable cv_schedule_
std::shared_mutex mutex_event_queue_
std::map<Tag, ActionListPtr> event_queue_
std::vector<ActionListPtr> action_list_pool_
std::vector<std::vector<BasePort*>> set_ports_
std::vector<std::vector<Reaction*>> triggered_reactions_
std::vector<std::vector<Reaction*>> reaction_queue_
unsigned int reaction_queue_pos_ = {std::numeric_limits<unsigned>::max()}
ReadyQueue ready_queue_
std::atomic<std::ptrdiff_t> reactions_to_process_ = {0}
std::atomic<bool> stop_ = {false}
bool continue_execution_ = {true}

Private Static Attributes

static constexpr std::size_t action_list_pool_increment_ = {10}