GRPC C++  1.26.0
Data Structures | Namespaces | Macros | Typedefs | Functions | Variables
closure.h File Reference
#include <grpc/support/port_platform.h>
#include <assert.h>
#include <stdbool.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/mpscq.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/profiling/timers.h"

Go to the source code of this file.

Data Structures

struct  grpc_closure_list
 
struct  grpc_closure
 A closure over a grpc_iomgr_cb_func. More...
 
struct  closure_impl::wrapped_closure
 
class  grpc_core::Closure
 

Namespaces

 closure_impl
 
 grpc_core
 Internal thread interface.
 

Macros

#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)   grpc_closure_init(__FILE__, __LINE__, closure, cb, cb_arg)
 Initializes closure with cb and cb_arg. More...
 
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler)   grpc_closure_create(__FILE__, __LINE__, cb, cb_arg)
 
#define GRPC_CLOSURE_LIST_INIT   { nullptr, nullptr }
 

Typedefs

typedef struct grpc_closure grpc_closure
 
typedef struct grpc_closure_list grpc_closure_list
 
typedef void(* grpc_iomgr_cb_func) (void *arg, grpc_error *error)
 gRPC Callback definition. More...
 

Functions

grpc_closuregrpc_closure_init (const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg)
 
void closure_impl::closure_wrapper (void *arg, grpc_error *error)
 
grpc_closuregrpc_closure_create (const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg)
 
void grpc_closure_list_init (grpc_closure_list *closure_list)
 
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-empty More...
 
void grpc_closure_list_fail_all (grpc_closure_list *list, grpc_error *forced_failure)
 force all success bits in list to false More...
 
void grpc_closure_list_move (grpc_closure_list *src, grpc_closure_list *dst)
 append all closures from src to dst and empty src. More...
 
bool grpc_closure_list_empty (grpc_closure_list closure_list)
 return whether list is empty. More...
 

Variables

grpc_core::DebugOnlyTraceFlag grpc_trace_closure
 

Macro Definition Documentation

◆ GRPC_CLOSURE_CREATE

#define GRPC_CLOSURE_CREATE (   cb,
  cb_arg,
  scheduler 
)    grpc_closure_create(__FILE__, __LINE__, cb, cb_arg)

◆ GRPC_CLOSURE_INIT

#define GRPC_CLOSURE_INIT (   closure,
  cb,
  cb_arg,
  scheduler 
)    grpc_closure_init(__FILE__, __LINE__, closure, cb, cb_arg)

Initializes closure with cb and cb_arg.

Returns closure.

◆ GRPC_CLOSURE_LIST_INIT

#define GRPC_CLOSURE_LIST_INIT   { nullptr, nullptr }

Typedef Documentation

◆ grpc_closure

typedef struct grpc_closure grpc_closure

◆ grpc_closure_list

◆ grpc_iomgr_cb_func

typedef void(* grpc_iomgr_cb_func) (void *arg, grpc_error *error)

gRPC Callback definition.

Parameters
argArbitrary input.
errorGRPC_ERROR_NONE if no error occurred, otherwise some grpc_error describing what went wrong. Error contract: it is not the cb's job to unref this error; the closure scheduler will do that after the cb returns

Function Documentation

◆ grpc_closure_create()

grpc_closure* grpc_closure_create ( const char *  file,
int  line,
grpc_iomgr_cb_func  cb,
void *  cb_arg 
)
inline

◆ grpc_closure_init()

grpc_closure* grpc_closure_init ( const char *  file,
int  line,
grpc_closure closure,
grpc_iomgr_cb_func  cb,
void *  cb_arg 
)
inline

◆ grpc_closure_list_append()

bool grpc_closure_list_append ( grpc_closure_list closure_list,
grpc_closure closure,
grpc_error error 
)
inline

add closure to the end of list and set closure's result to error Returns true if list becomes non-empty

◆ grpc_closure_list_empty()

bool grpc_closure_list_empty ( grpc_closure_list  closure_list)
inline

return whether list is empty.

◆ grpc_closure_list_fail_all()

void grpc_closure_list_fail_all ( grpc_closure_list list,
grpc_error forced_failure 
)
inline

force all success bits in list to false

◆ grpc_closure_list_init()

void grpc_closure_list_init ( grpc_closure_list closure_list)
inline

◆ grpc_closure_list_move()

void grpc_closure_list_move ( grpc_closure_list src,
grpc_closure_list dst 
)
inline

append all closures from src to dst and empty src.

Variable Documentation

◆ grpc_trace_closure

grpc_core::DebugOnlyTraceFlag grpc_trace_closure