SatDump 2.0.0-alpha-520736c72
Loading...
Searching...
No Matches
task_queue.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <functional>
9#include <mutex>
10#include <queue>
11#include <thread>
12
13namespace satdump
14{
24 {
25 private:
26 std::thread task_thread;
27 std::mutex queue_mtx;
28 std::queue<std::function<void()>> task_queue;
29
30 bool thread_exited = true;
31
32 private:
33 void threadFunc();
34
35 public:
39 TaskQueue();
40
45 ~TaskQueue();
46
51 void push(std::function<void()> task);
52 };
53} // namespace satdump
TaskQueue()
Constructor, starts the internal thread.
Definition task_queue.cpp:5
void push(std::function< void()> task)
Push a task in the queue.
Definition task_queue.cpp:42
~TaskQueue()
Destructor. Waits for remaining tasks before exiting.
Definition task_queue.cpp:7