![]() |
LeechCraft
%{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
|
A simple scheduling manager for a queue of functors. More...
#include "queuemanager.h"
Public Member Functions | |
UTIL_API | QueueManager (int timeout, QObject *parent=0) |
Creates a queue manager with the given timeout. More... | |
UTIL_API void | Schedule (std::function< void()> functor, QObject *dependent=0) |
Adds the given functor. More... | |
A simple scheduling manager for a queue of functors.
This class manages execution of functors that should be called with some minimal timeout between them.
Definition at line 49 of file queuemanager.h.
LeechCraft::Util::QueueManager::QueueManager | ( | int | timeout, |
QObject * | parent = 0 |
||
) |
Creates a queue manager with the given timeout.
[in] | timeout | The timeout between invoking the functions in milliseconds. |
[in] | parent | The parent object of this queue manager. |
Definition at line 37 of file queuemanager.cpp.
void LeechCraft::Util::QueueManager::Schedule | ( | std::function< void()> | functor, |
QObject * | dependent = 0 |
||
) |
Adds the given functor.
This function adds the given functor to the execution queue, or executes it right at the point of adding if more than timeout has passed since executing the last functor.
dependent is an object this functor depends upon. If dependent object is destructed by the time queue reaches the passed functor, the functor will be skipped and next scheduled functor will be executed (if any).
[in] | functor | The functor to add to the queue. |
[in] | dependent | The dependent object, or nullptr if this functor doesn't depend on anything. |
Definition at line 43 of file queuemanager.cpp.