19 #ifndef GRPC_CORE_LIB_IOMGR_CLOSURE_H
20 #define GRPC_CORE_LIB_IOMGR_CLOSURE_H
106 closure->
run =
false;
115 #define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler) \
116 grpc_closure_init(__FILE__, __LINE__, closure, cb, cb_arg)
118 #define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler) \
119 grpc_closure_init(closure, cb, cb_arg)
133 void* cb_arg = wc->
cb_arg;
161 #define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler) \
162 grpc_closure_create(__FILE__, __LINE__, cb, cb_arg)
164 #define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler) \
165 grpc_closure_create(cb, cb_arg)
168 #define GRPC_CLOSURE_LIST_INIT \
172 closure_list->
head = closure_list->
tail =
nullptr;
180 if (closure ==
nullptr) {
186 bool was_empty = (closure_list->
head ==
nullptr);
188 closure_list->
head = closure;
192 closure_list->
tail = closure;
210 if (src->
head ==
nullptr) {
213 if (dst->
head ==
nullptr) {
224 return closure_list.
head ==
nullptr;
233 if (closure ==
nullptr) {
245 closure->
cb(closure->
cb_arg, error);
Definition: closure.h:228
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error *error)
Definition: closure.h:230
Definition: debug_location.h:31
int line() const
Definition: debug_location.h:35
const char * file() const
Definition: debug_location.h:34
Definition: manual_constructor.h:169
bool enabled()
Definition: trace.h:80
bool grpc_closure_list_empty(grpc_closure_list closure_list)
return whether list is empty.
Definition: closure.h:223
struct grpc_closure_list grpc_closure_list
grpc_core::DebugOnlyTraceFlag grpc_trace_closure
void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst)
append all closures from src to dst and empty src.
Definition: closure.h:208
grpc_closure * grpc_closure_init(const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg)
Definition: closure.h:92
grpc_closure * grpc_closure_create(const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg)
Definition: closure.h:141
bool grpc_closure_list_append(grpc_closure_list *closure_list, grpc_closure *closure, grpc_error *error)
add closure to the end of list and set closure's result to error Returns true if list becomes non-emp...
Definition: closure.h:178
void grpc_closure_list_init(grpc_closure_list *closure_list)
Definition: closure.h:171
void(* grpc_iomgr_cb_func)(void *arg, grpc_error *error)
gRPC Callback definition.
Definition: closure.h:53
void grpc_closure_list_fail_all(grpc_closure_list *list, grpc_error *forced_failure)
force all success bits in list to false
Definition: closure.h:197
#define GRPC_ERROR_NONE
The following "special" errors can be propagated without allocating memory.
Definition: error.h:125
#define GRPC_ERROR_UNREF(err)
Definition: error.h:186
#define GRPC_ERROR_REF(err)
Definition: error.h:185
#define GPR_DEBUG
Macros to build log contexts at various severity levels.
Definition: log.h:55
#define GPR_ASSERT(x)
abort() the process if x is zero, having written a line to the log.
Definition: log.h:94
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
Log a message.
GPRAPI void gpr_free(void *ptr)
free
GPRAPI void * gpr_malloc(size_t size)
malloc.
Definition: closure.h:122
void closure_wrapper(void *arg, grpc_error *error)
Definition: closure.h:130
Internal thread interface.
Definition: backoff.h:26
Definition: closure.h:124
grpc_iomgr_cb_func cb
Definition: closure.h:125
grpc_closure wrapper
Definition: closure.h:127
void * cb_arg
Definition: closure.h:126
grpc_closure * tail
Definition: closure.h:43
grpc_closure * head
Definition: closure.h:42
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
bool scheduled
Definition: closure.h:82
int line_initiated
Definition: closure.h:87
bool run
Definition: closure.h:83
void * cb_arg
Arguments to be passed to "cb".
Definition: closure.h:71
union grpc_closure::@11 next_data
Once queued, next indicates the next queued closure; before then, scratch space.
grpc_closure * next
Definition: closure.h:60
uintptr_t scratch
Definition: closure.h:64
union grpc_closure::@12 error_data
Once queued, the result of the closure.
const char * file_created
Definition: closure.h:84
grpc_error * error
Definition: closure.h:75
int line_created
Definition: closure.h:85
grpc_core::ManualConstructor< grpc_core::MultiProducerSingleConsumerQueue::Node > mpscq_node
Definition: closure.h:63
const char * file_initiated
Definition: closure.h:86
grpc_iomgr_cb_func cb
Bound callback.
Definition: closure.h:68
Definition: error_internal.h:39