![]() |
TrinityCore
|
#include <TaskScheduler.h>
Public Member Functions | |
| TaskContext () noexcept | |
| TaskContext (TaskScheduler::TaskQueue::Container::node_type &&task, std::weak_ptr< TaskScheduler > &&owner) noexcept | |
| TaskContext (TaskContext const &right)=delete | |
| TaskContext (TaskContext &&right) noexcept | |
| TaskContext & | operator= (TaskContext const &right)=delete |
| TaskContext & | operator= (TaskContext &&right) noexcept |
| ~TaskContext () | |
| bool | IsExpired () const |
| Returns true if the owner was deallocated and this context has expired. | |
| bool | IsInGroup (TaskScheduler::group_t group) const |
| Returns true if the event is in the given group. | |
| TaskContext & | SetGroup (TaskScheduler::group_t group) |
| Sets the event in the given group. | |
| TaskContext & | ClearGroup () |
| Removes the group from the event. | |
| TaskScheduler::repeated_t | GetRepeatCounter () const |
| Returns the repeat counter which increases every time the task is repeated. | |
| TaskContext & | Repeat (TaskScheduler::duration_t duration) |
| TaskContext & | Repeat () |
| TaskContext & | Repeat (std::chrono::milliseconds min, std::chrono::milliseconds max) |
| TaskContext & | Async (std::function< void()> callable) |
| TaskContext & | Schedule (TaskScheduler::duration_t time, TaskScheduler::task_handler_t task) |
| TaskContext & | Schedule (TaskScheduler::duration_t time, TaskScheduler::group_t group, TaskScheduler::task_handler_t task) |
| TaskContext & | Schedule (std::chrono::milliseconds min, std::chrono::milliseconds max, TaskScheduler::task_handler_t task) |
| TaskContext & | Schedule (std::chrono::milliseconds min, std::chrono::milliseconds max, TaskScheduler::group_t group, TaskScheduler::task_handler_t task) |
| TaskContext & | CancelAll () |
| Cancels all tasks from within the context. | |
| TaskContext & | CancelGroup (TaskScheduler::group_t group) |
| Cancel all tasks of a single group from within the context. | |
| TaskContext & | CancelGroupsOf (std::span< TaskScheduler::group_t > groups) |
| TaskContext & | DelayAll (TaskScheduler::duration_t duration) |
| Delays all tasks with the given duration from within the context. | |
| TaskContext & | DelayAll (std::chrono::milliseconds min, std::chrono::milliseconds max) |
| Delays all tasks with a random duration between min and max from within the context. | |
| TaskContext & | DelayGroup (TaskScheduler::group_t group, TaskScheduler::duration_t duration) |
| Delays all tasks of a group with the given duration from within the context. | |
| TaskContext & | DelayGroup (TaskScheduler::group_t group, std::chrono::milliseconds min, std::chrono::milliseconds max) |
| Delays all tasks of a group with a random duration between min and max from within the context. | |
| TaskContext & | RescheduleAll (TaskScheduler::duration_t duration) |
| Reschedule all tasks with the given duration. | |
| TaskContext & | RescheduleAll (std::chrono::milliseconds min, std::chrono::milliseconds max) |
| Reschedule all tasks with a random duration between min and max. | |
| TaskContext & | RescheduleGroup (TaskScheduler::group_t group, TaskScheduler::duration_t duration) |
| Reschedule all tasks of a group with the given duration. | |
| TaskContext & | RescheduleGroup (TaskScheduler::group_t group, std::chrono::milliseconds min, std::chrono::milliseconds max) |
| Reschedule all tasks of a group with a random duration between min and max. | |
Private Member Functions | |
| void | Invoke () |
| Invokes the associated hook of the task. | |
| TaskScheduler::TaskContainer & | GetTaskContainer () noexcept |
| TaskScheduler::Task * | GetTask () const noexcept |
Private Attributes | |
| std::variant< TaskScheduler::TaskQueue::Container::node_type, TaskScheduler::TaskContainer > | _task |
| Associated task. | |
| std::weak_ptr< TaskScheduler > | _owner |
| Owner. | |
Friends | |
| class | TaskScheduler |
Definition at line 369 of file TaskScheduler.h.
|
inlinenoexcept |
Definition at line 382 of file TaskScheduler.h.
|
explicitnoexcept |
Definition at line 265 of file TaskScheduler.cpp.
|
delete |
|
noexcept |
Definition at line 270 of file TaskScheduler.cpp.
|
default |
| TaskContext & TaskContext::Async | ( | std::function< void()> | callable | ) |
Schedule a callable function that is executed at the next update tick from within the context. Its safe to modify the TaskScheduler from within the callable.
Definition at line 344 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| TaskContext & TaskContext::CancelAll | ( | ) |
Cancels all tasks from within the context.
Definition at line 368 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| TaskContext & TaskContext::CancelGroup | ( | TaskScheduler::group_t | group | ) |
Cancel all tasks of a single group from within the context.
Definition at line 376 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| TaskContext & TaskContext::CancelGroupsOf | ( | std::span< TaskScheduler::group_t > | groups | ) |
Cancels all groups in the given std::vector from within the context. Hint: Use std::initializer_list for this: "{1, 2, 3, 4}"
Definition at line 384 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| TaskContext & TaskContext::ClearGroup | ( | ) |
Removes the group from the event.
Definition at line 308 of file TaskScheduler.cpp.
|
inline |
Delays all tasks with a random duration between min and max from within the context.
Definition at line 491 of file TaskScheduler.h.
Here is the call graph for this function:| TaskContext & TaskContext::DelayAll | ( | TaskScheduler::duration_t | duration | ) |
Delays all tasks with the given duration from within the context.
Definition at line 392 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Delays all tasks of a group with a random duration between min and max from within the context.
Definition at line 501 of file TaskScheduler.h.
Here is the call graph for this function:| TaskContext & TaskContext::DelayGroup | ( | TaskScheduler::group_t | group, |
| TaskScheduler::duration_t | duration | ||
| ) |
Delays all tasks of a group with the given duration from within the context.
Definition at line 400 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| TaskScheduler::repeated_t TaskContext::GetRepeatCounter | ( | ) | const |
Returns the repeat counter which increases every time the task is repeated.
Definition at line 314 of file TaskScheduler.cpp.
Here is the caller graph for this function:
|
privatenoexcept |
Definition at line 441 of file TaskScheduler.cpp.
|
privatenoexcept |
Definition at line 429 of file TaskScheduler.cpp.
|
private |
Invokes the associated hook of the task.
Definition at line 424 of file TaskScheduler.cpp.
Here is the caller graph for this function:| bool TaskContext::IsExpired | ( | ) | const |
Returns true if the owner was deallocated and this context has expired.
Definition at line 292 of file TaskScheduler.cpp.
| bool TaskContext::IsInGroup | ( | TaskScheduler::group_t | group | ) | const |
Returns true if the event is in the given group.
Definition at line 297 of file TaskScheduler.cpp.
|
noexcept |
Definition at line 277 of file TaskScheduler.cpp.
|
delete |
| TaskContext & TaskContext::Repeat | ( | ) |
Repeats the event with the same duration. This will consume the task context, its not possible to repeat the task again from the same task context!
Definition at line 339 of file TaskScheduler.cpp.
|
inline |
Repeats the event and set a new duration that is randomized between min and max. std::chrono::seconds(5) for example. This will consume the task context, its not possible to repeat the task again from the same task context!
Definition at line 432 of file TaskScheduler.h.
Here is the call graph for this function:| TaskContext & TaskContext::Repeat | ( | TaskScheduler::duration_t | duration | ) |
Repeats the event and sets a new duration. std::chrono::seconds(5) for example. This will consume the task context, its not possible to repeat the task again from the same task context!
Definition at line 319 of file TaskScheduler.cpp.
Here is the caller graph for this function:
|
inline |
Reschedule all tasks with a random duration between min and max.
Definition at line 512 of file TaskScheduler.h.
Here is the call graph for this function:| TaskContext & TaskContext::RescheduleAll | ( | TaskScheduler::duration_t | duration | ) |
Reschedule all tasks with the given duration.
Definition at line 408 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Reschedule all tasks of a group with a random duration between min and max.
Definition at line 522 of file TaskScheduler.h.
Here is the call graph for this function:| TaskContext & TaskContext::RescheduleGroup | ( | TaskScheduler::group_t | group, |
| TaskScheduler::duration_t | duration | ||
| ) |
Reschedule all tasks of a group with the given duration.
Definition at line 416 of file TaskScheduler.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Schedule an event with a randomized rate between min and max rate from within the context. Its possible that the new event is executed immediately! Use TaskScheduler::Async to create a task which will be called at the next update tick.
Definition at line 470 of file TaskScheduler.h.
Here is the call graph for this function:
|
inline |
Schedule an event with a randomized rate between min and max rate from within the context. Its possible that the new event is executed immediately! Use TaskScheduler::Async to create a task which will be called at the next update tick.
Definition at line 460 of file TaskScheduler.h.
Here is the call graph for this function:| TaskContext & TaskContext::Schedule | ( | TaskScheduler::duration_t | time, |
| TaskScheduler::group_t | group, | ||
| TaskScheduler::task_handler_t | task | ||
| ) |
Schedule an event with a fixed rate from within the context. Its possible that the new event is executed immediately! Use TaskScheduler::Async to create a task which will be called at the next update tick.
Definition at line 360 of file TaskScheduler.cpp.
| TaskContext & TaskContext::Schedule | ( | TaskScheduler::duration_t | time, |
| TaskScheduler::task_handler_t | task | ||
| ) |
Schedule an event with a fixed rate from within the context. Its possible that the new event is executed immediately! Use TaskScheduler::Async to create a task which will be called at the next update tick.
Definition at line 352 of file TaskScheduler.cpp.
Here is the caller graph for this function:| TaskContext & TaskContext::SetGroup | ( | TaskScheduler::group_t | group | ) |
Sets the event in the given group.
Definition at line 302 of file TaskScheduler.cpp.
|
friend |
Definition at line 371 of file TaskScheduler.h.
|
private |
Owner.
Definition at line 378 of file TaskScheduler.h.
|
private |
Associated task.
Definition at line 375 of file TaskScheduler.h.