Bitcoin ABC 0.33.11
P2P Digital Currency
task_runner.h
Go to the documentation of this file.
1// Copyright (c) 2024-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_UTIL_TASK_RUNNER_H
6#define BITCOIN_UTIL_TASK_RUNNER_H
7
8#include <cstddef>
9#include <functional>
10
11namespace util {
12
20public:
22
28 virtual void insert(std::function<void()> func) = 0;
29
33 virtual void flush() = 0;
34
38 virtual size_t size() = 0;
39};
40
42public:
43 void insert(std::function<void()> func) override { func(); }
44 void flush() override {}
45 size_t size() override { return 0; }
46};
47
48} // namespace util
49
50#endif // BITCOIN_UTIL_TASK_RUNNER_H
size_t size() override
Returns the number of currently pending events.
Definition: task_runner.h:45
void insert(std::function< void()> func) override
The callback can either be queued for later/asynchronous/threaded processing, or be executed immediat...
Definition: task_runner.h:43
void flush() override
Forces the processing of all pending events.
Definition: task_runner.h:44
virtual size_t size()=0
Returns the number of currently pending events.
virtual void flush()=0
Forces the processing of all pending events.
virtual void insert(std::function< void()> func)=0
The callback can either be queued for later/asynchronous/threaded processing, or be executed immediat...
virtual ~TaskRunnerInterface()
Definition: task_runner.h:21