vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
counting_completion.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/concurrency/completion.hpp>
6#include <vitrio/concurrency/completion_notifier.hpp>
7#include <vitrio/export.hpp>
8
9#include <cstddef>
10#include <memory>
11
12namespace vitrio
13{
14
37 : public completion
38 , public completion_notifier
39{
40public:
50 VITRIO_API
51 explicit counting_completion(std::size_t count);
52
53 counting_completion(const counting_completion &other) = delete;
55
56 VITRIO_API
57 ~counting_completion() override;
58
60 operator=(const counting_completion &other) = delete;
62 operator=(counting_completion &&other) = delete;
63
64 VITRIO_API
65 void notify_done(std::exception_ptr error = nullptr) override;
66
67 VITRIO_API
68 void wait() const override;
69
70 VITRIO_API
71 bool is_ready() const noexcept override;
72
73 VITRIO_API
74 void get() const override;
75
76private:
77 class implementation;
78 std::unique_ptr<implementation> m_implementation;
79};
80
81} // namespace vitrio
Where a finished unit of work is reported.
Definition completion_notifier.hpp:20
A query-only view of whether one or more units of work have finished.
Definition completion.hpp:18
A completion that resolves once a fixed number of units of work have all reported in.
Definition counting_completion.hpp:39
void get() const override
Wait, then rethrow the first exception recorded, if any.
void notify_done(std::exception_ptr error=nullptr) override
Report that one unit of work has finished.
void wait() const override
Block the calling thread until this is ready.
bool is_ready() const noexcept override
Whether the work behind this has finished.
counting_completion(std::size_t count)
Construct a completion for a known number of units of work.