Sen API
Sen Libraries
Toggle main menu visibility
Loading...
Searching...
No Matches
work_queue.h
Go to the documentation of this file.
1
// === work_queue.h ====================================================================================================
2
// Sen Infrastructure
3
// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4
// See the LICENSE.txt file for more information.
5
// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6
// =====================================================================================================================
7
8
#ifndef SEN_CORE_OBJ_DETAIL_WORK_QUEUE_H
9
#define SEN_CORE_OBJ_DETAIL_WORK_QUEUE_H
10
11
// sen
12
#include "
sen/core/base/class_helpers.h
"
13
#include "
sen/core/base/duration.h
"
14
#include "
sen/core/base/move_only_function.h
"
15
16
// std
17
#include <memory>
18
19
namespace
sen::impl
20
{
21
22
// Represents a unit of work.
23
using
Call =
sen::std_util::move_only_function
<void()>;
24
25
class
WorkQueueImpl;
26
29
class
WorkQueue final
30
{
31
public
:
32
SEN_NOCOPY_NOMOVE(WorkQueue)
33
34
public
:
35
WorkQueue(std::size_t maxSize,
bool
dropOldest);
36
~WorkQueue();
37
38
public
:
40
void
enable();
41
43
void
disable();
44
46
void
clear();
47
49
void
push(Call&& call,
bool
force
);
50
52
[[nodiscard]]
bool
executeAll();
53
55
void
waitExecuteOne();
56
58
void
waitExecuteAll(
const
Duration& timeout);
59
61
void
setOnDropped(
std_util::move_only_function
<
void
(
const
Call&)>&& callback);
62
64
[[nodiscard]] std::size_t getCurrentSize() const noexcept;
65
66
private:
67
std::unique_ptr<WorkQueueImpl> pimpl_;
68
};
69
70
}
// namespace sen::impl
71
72
#endif
// SEN_CORE_OBJ_DETAIL_WORK_QUEUE_H
class_helpers.h
Here we define a set of template meta-programming helpers to let the compiler take some decisions bas...
duration.h
sen::UnitCategory::force
@ force
Definition
unit.h:40
move_only_function.h
sen::std_util::move_only_function
detail::MoveOnlyFunctionImpl< FwdArgs... > move_only_function
Definition
move_only_function.h:256
libs
core
include
sen
core
obj
detail
work_queue.h
Generated by
1.17.0