New cpp folder structure

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-17 22:35:52 +03:00
committed by Konstantin Pastbin
parent c9cbb64f12
commit 76ffc99abd
2390 changed files with 345 additions and 339 deletions

30
libs/base/task_loop.hpp Normal file
View File

@@ -0,0 +1,30 @@
#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