intra_activity_waiter.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_CORE_LIB_PROMISE_INTRA_ACTIVITY_WAITER_H
16 #define GRPC_CORE_LIB_PROMISE_INTRA_ACTIVITY_WAITER_H
17 
19 
22 
23 namespace grpc_core {
24 
25 // Helper type to track wakeups between objects in the same activity.
26 // Can be fairly fast as no ref counting or locking needs to occur.
28  public:
29  // Register for wakeup, return Pending(). If state is not ready to proceed,
30  // Promises should bottom out here.
32  waiting_ = true;
33  return Pending();
34  }
35  // Wake the activity
36  void Wake() {
37  if (waiting_) {
38  waiting_ = false;
40  }
41  }
42 
43  private:
44  bool waiting_ = false;
45 };
46 
47 } // namespace grpc_core
48 
49 #endif // GRPC_CORE_LIB_PROMISE_INTRA_ACTIVITY_WAITER_H
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::Activity::current
static Activity * current()
Definition: activity.h:124
grpc_core::IntraActivityWaiter
Definition: intra_activity_waiter.h:27
grpc_core::Pending
Definition: poll.h:29
poll.h
grpc_core::Activity::ForceImmediateRepoll
virtual void ForceImmediateRepoll()=0
grpc_core::IntraActivityWaiter::pending
Pending pending()
Definition: intra_activity_waiter.h:31
grpc_core::IntraActivityWaiter::Wake
void Wake()
Definition: intra_activity_waiter.h:36
activity.h
grpc_core::IntraActivityWaiter::waiting_
bool waiting_
Definition: intra_activity_waiter.h:44
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:07