Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
util
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
11
namespace
util
{
12
18
19
class
TaskRunnerInterface
20
{
21
public
:
22
virtual
~TaskRunnerInterface
() =
default
;
23
28
29
virtual
void
insert
(std::function<
void
()> func) = 0;
30
34
virtual
void
flush
() = 0;
35
39
virtual
size_t
size
() = 0;
40
};
41
42
class
ImmediateTaskRunner
:
public
TaskRunnerInterface
43
{
44
public
:
45
void
insert
(std::function<
void
()> func)
override
{ func(); }
46
void
flush
()
override
{}
47
size_t
size
()
override
{
return
0; }
48
};
49
50
}
// namespace util
51
52
#endif
// BITCOIN_UTIL_TASK_RUNNER_H
util::ImmediateTaskRunner
Definition
task_runner.h:43
util::ImmediateTaskRunner::size
size_t size() override
Returns the number of currently pending events.
Definition
task_runner.h:47
util::ImmediateTaskRunner::insert
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:45
util::ImmediateTaskRunner::flush
void flush() override
Forces the processing of all pending events.
Definition
task_runner.h:46
util::TaskRunnerInterface
Definition
task_runner.h:20
util::TaskRunnerInterface::size
virtual size_t size()=0
Returns the number of currently pending events.
util::TaskRunnerInterface::flush
virtual void flush()=0
Forces the processing of all pending events.
util::TaskRunnerInterface::insert
virtual void insert(std::function< void()> func)=0
The callback can either be queued for later/asynchronous/threaded processing, or be executed immediat...
util::TaskRunnerInterface::~TaskRunnerInterface
virtual ~TaskRunnerInterface()=default
util
Definition
httpserver.h:13
Generated on
for Bitcoin Core by
1.17.0