grpc
src
core
lib
promise
exec_ctx_wakeup_scheduler.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_EXEC_CTX_WAKEUP_SCHEDULER_H
16
#define GRPC_CORE_LIB_PROMISE_EXEC_CTX_WAKEUP_SCHEDULER_H
17
18
#include <
grpc/support/port_platform.h
>
19
20
#include "
src/core/lib/gprpp/debug_location.h
"
21
#include "
src/core/lib/iomgr/closure.h
"
22
#include "
src/core/lib/iomgr/error.h
"
23
#include "
src/core/lib/iomgr/exec_ctx.h
"
24
25
namespace
grpc_core
{
26
27
// A callback scheduler for activities that works by scheduling callbacks on the
28
// exec ctx.
29
class
ExecCtxWakeupScheduler
{
30
public
:
31
template
<
typename
ActivityType>
32
void
ScheduleWakeup
(ActivityType* activity) {
33
GRPC_CLOSURE_INIT
(
34
&
closure_
,
35
[](
void
*
arg
,
grpc_error_handle
) {
36
static_cast<
ActivityType*
>
(
arg
)->RunScheduledWakeup();
37
},
38
activity, grpc_schedule_on_exec_ctx);
39
ExecCtx::Run
(
DEBUG_LOCATION
, &
closure_
,
GRPC_ERROR_NONE
);
40
}
41
42
private
:
43
grpc_closure
closure_
;
44
};
45
46
}
// namespace grpc_core
47
48
#endif // GRPC_CORE_LIB_PROMISE_EXEC_CTX_WAKEUP_SCHEDULER_H
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition:
closure.h:115
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition:
error.h:234
grpc_core
Definition:
call_metric_recorder.h:31
closure.h
grpc_core::ExecCtxWakeupScheduler::closure_
grpc_closure closure_
Definition:
exec_ctx_wakeup_scheduler.h:43
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition:
debug_location.h:41
arg
Definition:
cmdline.cc:40
error.h
debug_location.h
arg
struct arg arg
exec_ctx.h
grpc_core::ExecCtx::Run
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
Definition:
exec_ctx.cc:98
grpc_core::ExecCtxWakeupScheduler
Definition:
exec_ctx_wakeup_scheduler.h:29
grpc_error
Definition:
error_internal.h:42
grpc_core::ExecCtxWakeupScheduler::ScheduleWakeup
void ScheduleWakeup(ActivityType *activity)
Definition:
exec_ctx_wakeup_scheduler.h:32
grpc_closure
Definition:
closure.h:56
port_platform.h
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:20