8 #ifndef WPP_TASK_QUEUE_H_
9 #define WPP_TASK_QUEUE_H_
17 #define WPP_TASK_MIN_DELAY_S (time_t)0
18 #define WPP_TASK_DEF_DELAY_S (time_t)1
19 #define WPP_TASK_MAX_DELAY_S (time_t)(0xFFFFFFF)
21 #define WPP_TASK_DEF_CTX NULL
22 #define WPP_ERR_TASK_ID 0
64 enum TaskState : uint8_t {
67 SHOULD_BE_DELETED = 4,
208 void deleteFinishedTasks();
213 time_t updateNextCallTimeForTasks();
221 static WppGuard _handleTaskGuard;
222 static WppGuard _taskQueueGuard;
223 static WppTaskQueue _instance;
234 std::list<TaskInfo *> _tasks;
Represents a client interface for Wpp library.
std::function< bool(WppClient &, void *)> task_t
static time_t handleEachTask(WppClient &client)
Execute each task in the queue and delete it from queue if task returns false or task state is SHOULD...
static bool isTaskShouldBeDeleted(task_id_t id)
static size_t getTaskCnt()
Returns count of tasks in the queue. Tasks count does not immediately updated after request to remove...
static void requestToRemoveEachTask()
This function does not immediately delete all tasks, it only marks them as one that should be deleted...
static bool isTaskExist(task_id_t id)
Returns true if task exists in the queue.
static bool isTaskExecuting(task_id_t id)
static task_id_t addTask(time_t delaySec, task_t task)
Add task to queue, ctx that passed to task equals to NULL.
static bool isTaskIdle(task_id_t id)
Returns true if state corresponds to function.
static task_id_t addTaskWithCopy(const void *ctx, size_t size, time_t delaySec, task_t task)
Add task to queue, ctx passed to task by pointer with copy, allocated memory will be relesed after de...
static void requestToRemoveTask(task_id_t id)
This function does not immediately delete the task, it only marks it as one that should be deleted at...
static void hardReset()
Blocks task handling, calls of other methods, and deletes all tasks from the queue,...
The WppConnection class represents a connection interface for the Wpp library.