9#ifndef SKYWAY_GLOBAL_WORKER_HPP_
10#define SKYWAY_GLOBAL_WORKER_HPP_
15#include <condition_variable>
17#include "skyway/global/interface/worker.hpp"
23class Worker :
public interface::Worker {
25 using Task = std::function<void()>;
36 Worker(
const std::string& name);
43 void AddTask(Task& task)
override;
44 void AddTask(
const Task&& task)
override;
48 void ProcessWorker(
const std::string& name);
49 int SetThreadName(
const std::string& name);
50 std::deque<Task> tasks_;
52 std::condition_variable cv_;
53 bool is_termination_requested_ =
false;