Class Scheduler¶
Defined in File scheduler.hpp
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
()¶
-
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::idcreateThread
(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.
-
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 boolhookProcess
(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.
Friends
- friend struct legion::core::async::job_pool_base