C/C++ API Reference
Loading...
Searching...
No Matches
notification.h
1// Copyright 2026 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14#pragma once
15
16#include "pw_async2/value_future.h"
17
18namespace pw::async2 {
19
21
24 public:
25 constexpr Notification() = default;
26
27 Notification(Notification&&) = default;
28 Notification& operator=(Notification&&) = default;
29 Notification(const Notification&) = delete;
30 Notification& operator=(const Notification&) = delete;
31
35 VoidFuture Wait() { return provider_.Get(); }
36
38 void Notify() { provider_.Resolve(); }
39
40 private:
42};
43
44} // namespace pw::async2
Definition: value_future.h:199
ValueFuture< T > Get()
Definition: value_future.h:227
void Resolve(const U &value)
Resolves every pending ValueFuture with a copy of the provided value.
Definition: value_future.h:238
A notification that multiple futures can wait on.
Definition: notification.h:23
Definition: value_future.h:135
VoidFuture Wait()
Definition: notification.h:35
void Notify()
Wakes all waiting tasks.
Definition: notification.h:38