6#include <userver/engine/single_use_event.hpp>
10namespace utils::impl {
13class WaitTokenStorage
final {
17 Token()
noexcept =
default;
18 Token(Token&&)
noexcept;
19 Token(
const Token&)
noexcept;
20 Token& operator=(Token&&)
noexcept;
21 Token& operator=(
const Token&)
noexcept;
25 explicit Token(WaitTokenStorage& storage)
noexcept;
28 WaitTokenStorage* storage_{
nullptr};
33 WaitTokenStorage(
const WaitTokenStorage&) =
delete;
34 WaitTokenStorage(WaitTokenStorage&&) =
delete;
40 std::uint64_t AliveTokensApprox()
const noexcept;
45 void WaitForAllTokens()
noexcept;
48 std::atomic<std::int64_t> tokens_;
49 engine::SingleUseEvent event_;