|
| | basic_scheduler () |
| | Default constructor.
|
| | basic_scheduler (const allocator_type &allocator) |
| | Constructs a scheduler with a given allocator.
|
|
| basic_scheduler (const basic_scheduler &)=delete |
| | Default copy constructor, deleted on purpose.
|
| | basic_scheduler (basic_scheduler &&other) noexcept |
| | Move constructor.
|
| | basic_scheduler (basic_scheduler &&other, const allocator_type &allocator) |
| | Allocator-extended move constructor.
|
|
| ~basic_scheduler ()=default |
| | Default destructor.
|
| basic_scheduler & | operator= (const basic_scheduler &)=delete |
| | Default copy assignment operator, deleted on purpose.
|
| basic_scheduler & | operator= (basic_scheduler &&other) noexcept |
| | Move assignment operator.
|
| void | swap (basic_scheduler &other) noexcept |
| | Exchanges the contents with those of a given scheduler.
|
| constexpr allocator_type | get_allocator () const noexcept |
| | Returns the associated allocator.
|
| size_type | size () const noexcept |
| | Number of processes currently scheduled.
|
| bool | empty () const noexcept |
| | Returns true if at least a process is currently scheduled.
|
| void | clear () |
| | Discards all scheduled processes.
|
| template<typename Type, typename... Args> |
| type & | attach (Args &&...args) |
| | Schedules a process for the next tick.
|
| template<typename Func> |
| type & | attach (Func func) |
| | Schedules a process for the next tick.
|
| void | update (const delta_type delta, void *data=nullptr) |
| | Updates all scheduled processes.
|
| void | abort (const bool immediate=false) |
| | Aborts all scheduled processes.
|
template<typename Delta, typename Allocator>
class entt::basic_scheduler< Delta, Allocator >
Cooperative scheduler for processes.
A cooperative scheduler runs processes and helps managing their life cycles.
Each process is invoked once per tick. If a process terminates, it's removed automatically from the scheduler and it's never invoked again.
A process can also have a child. In this case, the process is replaced with its child when it terminates if it returns with success. In case of errors, both the process and its child are discarded.
In order to invoke all scheduled processes, call the update member function passing it the elapsed time to forward to the tasks.
- See also
- process
- Template Parameters
-
| Delta | Type to use to provide elapsed time. |
| Allocator | Type of allocator used to manage memory and elements. |
Definition at line 36 of file scheduler.hpp.
template<typename Delta, typename Allocator>
Aborts all scheduled processes.
Unless an immediate operation is requested, the abort is scheduled for the next tick. Processes won't be executed anymore in any case.
Once a process is fully aborted and thus finished, it's discarded along with its child, if any.
- Parameters
-
| immediate | Requests an immediate operation. |
Definition at line 211 of file scheduler.hpp.
template<typename Delta, typename Allocator>
Updates all scheduled processes.
All scheduled processes are executed in no specific order.
If a process terminates with success, it's replaced with its child, if any. Otherwise, if a process terminates with an error, it's removed along with its child.
- Parameters
-
| delta | Elapsed time. |
| data | Optional data. |
Definition at line 183 of file scheduler.hpp.