/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
base/task_loop.hpp
30 строк
652 B
Arsentiy Milchakov
[base] TaskLoop::kIncorrectId is renamed to kNoId
10 дек 2020, 20:05
10 дек 2020, 20:05
a0a66d8
Код
Авторство
О чём код?
#pragma once #include <cstdint> #include <functional> namespace base { class TaskLoop { public: using Task = std::function<void()>; using TaskId = uint64_t; static TaskId constexpr kNoId = 0; struct PushResult { // Contains true when task is posted successfully. bool m_isSuccess = false; // Contains id of posted task which can be used to access the task to cancel/suspend/etc it. // kNoId is returned for tasks that cannot be accessed. TaskId m_id = kNoId; }; virtual ~TaskLoop() = default; virtual PushResult Push(Task && task) = 0; virtual PushResult Push(Task const & task) = 0; }; } // namespace base