Class Scheduler

Nested Relationships

Class Documentation

class legion::core::scheduling::Scheduler

Major engine part that handles the creation and destruction of threads and process chains. Also takes charge of the main program loop.

Note

Also handle synchronization.

Public Functions

Scheduler(events::EventBus *eventBus, bool lowPower, uint minThreads)
~Scheduler()
inline void setTimeScale(float scale)

Set global time scale.

inline float getTimeScale()

Get the global time scale.

void run()

Run main program loop, also starts all process-chains in their own threads.

template<typename Function, typename ...Args>
inline std::thread::id createThread(Function &&function, Args&&... args)

Create a new thread.

Return

std::thread::id Id of new thread if thread was created, 0 id if there are no available threads.

Parameters
  • function: Function to run on the thread.

  • ...args: Arguments to pass to the function.

template<size_type charc>
inline std::thread::id getChainThreadId(const char (&name)[charc])
inline std::thread::id getChainThreadId(id_type chainId)
template<typename Func>
inline auto sendCommand(std::thread::id id, const Func &func)
template<typename Func>
inline auto queueJobs(size_type count, const Func &func)
void destroyThread(std::thread::id id)

Destroy a thread.

Warning

DON’T USE UNLESS YOU KNOW WHAT YOU ARE DOING.

void reportExit(const std::thread::id &id)

Report an intentional exit from a thread.

void reportExitWithError(const std::string &name, const std::thread::id &id, const legion::core::exception &exc)

Report an unintentional exit from a thread.

void reportExitWithError(const std::thread::id &id, const legion::core::exception &exc)

Report an unintentional exit from a thread.

void reportExitWithError(const std::string &name, const std::thread::id &id, const std::exception &exc)

Report an unintentional exit from a thread.

void reportExitWithError(const std::thread::id &id, const std::exception &exc)

Report an unintentional exit from a thread.

inline void subscribeToSync()
inline void unsubscribeFromSync()
void waitForProcessSync()

Request thread synchronization and wait for that synchronization moment.

inline bool syncRequested()

Check if a synchronization has been requested.

template<size_type charc>
inline ProcessChain *getChain(const char (&name)[charc])

Get pointer to a certain process-chain.

template<size_type charc>
inline ProcessChain *addProcessChain(const char (&name)[charc])

Create a new process-chain.

template<size_type charc>
inline bool hookProcess(const char (&processChainName)[charc], Process *process)

Hook a process to a certain chain.

Return

bool True if succeeded, false if the chain doesn’t exist.

bool hookProcess(cstring chainName, Process *process)

Hook a process to a certain chain.

Return

bool True if succeeded, false if the chain doesn’t exist.

template<size_type charc>
inline bool unhookProcess(const char (&chainName)[charc], Process *process)

Unhook a process from a certain chain.

Return

bool True if succeeded, false if the chain doesn’t exist.

bool unhookProcess(cstring chainName, Process *process)

Unhook a process from a certain chain.

Return

bool True if succeeded, false if the chain doesn’t exist.

Friends

friend struct legion::core::async::job_pool_base