C/C++ API Reference
Loading...
Searching...
No Matches
await.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/try.h"
17#include "pw_preprocessor/arguments.h"
18
20
86// Doxygen/Doxylink struggle with correct parsing and linking when this is
87// defined as a variadic macro. We use PW_EXCLUDE_FROM_DOXYGEN to provide a
88// simplified argument-less definition that generates a clean entry in the tag
89// file, ensuring reliable linking.
90#ifdef PW_EXCLUDE_FROM_DOXYGEN
91#define PW_AWAIT
92#else
93#define PW_AWAIT(...) PW_DELEGATE_BY_ARG_COUNT(_PW_AWAIT_, __VA_ARGS__)
94#endif
95
97#define _PW_AWAIT_2(future, cx) PW_TRY_READY((future).Pend(cx))
98#define _PW_AWAIT_3(lhs, future, cx) PW_TRY_READY_ASSIGN(lhs, (future).Pend(cx))
100