19 #ifndef GRPC_CORE_LIB_IOMGR_CALL_COMBINER_H
20 #define GRPC_CORE_LIB_IOMGR_CALL_COMBINER_H
55 #define GRPC_CALL_COMBINER_START(call_combiner, closure, error, reason) \
56 (call_combiner)->Start((closure), (error), __FILE__, __LINE__, (reason))
57 #define GRPC_CALL_COMBINER_STOP(call_combiner, reason) \
58 (call_combiner)->Stop(__FILE__, __LINE__, (reason))
61 int line,
const char* reason);
63 void Stop(
const char* file,
int line,
const char* reason);
65 #define GRPC_CALL_COMBINER_START(call_combiner, closure, error, reason) \
66 (call_combiner)->Start((closure), (error), (reason))
67 #define GRPC_CALL_COMBINER_STOP(call_combiner, reason) \
68 (call_combiner)->Stop((reason))
72 void Stop(
const char* reason);
107 #ifdef GRPC_TSAN_ENABLED
108 static void TsanClosure(
void* arg,
grpc_error* error);
117 #ifdef GRPC_TSAN_ENABLED
125 struct TsanLock :
public RefCounted<TsanLock, NonPolymorphicRefCount> {
131 std::atomic<bool> taken{
false};
133 RefCountedPtr<TsanLock> tsan_lock_ = MakeRefCounted<TsanLock>();
164 if (closures_.
empty()) {
168 for (
size_t i = 1; i < closures_.
size(); ++i) {
169 auto& closure = closures_[i];
175 "CallCombinerClosureList executing closure while already "
176 "holding call_combiner %p: closure=%p error=%s reason=%s",
177 call_combiner, closures_[0].closure,
188 for (
size_t i = 0; i < closures_.
size(); ++i) {
189 auto& closure = closures_[i];
199 struct CallCombinerClosure {
206 : closure(closure), error(error), reason(reason) {}
211 InlinedVector<CallCombinerClosure, 6> closures_;
#define GRPC_CALL_COMBINER_STOP(call_combiner, reason)
Definition: call_combiner.h:57
#define GRPC_CALL_COMBINER_START(call_combiner, closure, error, reason)
Definition: call_combiner.h:55
Definition: call_combiner.h:146
void RunClosures(CallCombiner *call_combiner)
Definition: call_combiner.h:163
CallCombinerClosureList()
Definition: call_combiner.h:148
void Add(grpc_closure *closure, grpc_error *error, const char *reason)
Definition: call_combiner.h:152
size_t size() const
Definition: call_combiner.h:196
void RunClosuresWithoutYielding(CallCombiner *call_combiner)
Definition: call_combiner.h:187
Definition: call_combiner.h:49
void Start(grpc_closure *closure, grpc_error *error, const char *file, int line, const char *reason)
Starts processing closure.
void SetNotifyOnCancel(grpc_closure *closure)
Registers closure to be invoked when Cancel() is called.
void Cancel(grpc_error *error)
Indicates that the call has been cancelled.
void Stop(const char *file, int line, const char *reason)
Yields the call combiner to the next closure in the queue, if any.
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error *error)
void emplace_back(Args &&... args)
Definition: inlined_vector.h:145
size_t size() const
Definition: inlined_vector.h:165
bool empty() const
Definition: inlined_vector.h:166
void clear()
Definition: inlined_vector.h:170
Definition: ref_counted.h:248
#define DEBUG_LOCATION
Definition: debug_location.h:41
#define TSAN_ANNOTATE_RWLOCK_CREATE(addr)
Definition: dynamic_annotations.h:60
#define TSAN_ANNOTATE_RWLOCK_DESTROY(addr)
Definition: dynamic_annotations.h:61
const char * grpc_error_string(grpc_error *error)
intptr_t gpr_atm
Definition: atm_gcc_atomic.h:30
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
Log a message.
#define GPR_INFO
Definition: log.h:56
Internal thread interface.
Definition: backoff.h:26
TraceFlag DebugOnlyTraceFlag
Definition: trace.h:115
DebugOnlyTraceFlag grpc_call_combiner_trace
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Definition: error_internal.h:39
#define GRPC_TRACE_FLAG_ENABLED(f)
Definition: trace.h:112