Public Member Functions | Private Member Functions | Private Attributes | List of all members
grpc_core::CallCombiner Class Reference

#include <call_combiner.h>

Public Member Functions

 CallCombiner ()
 
void Cancel (grpc_error_handle error)
 Indicates that the call has been cancelled. More...
 
void SetNotifyOnCancel (grpc_closure *closure)
 
void Start (grpc_closure *closure, grpc_error_handle error, const char *file, int line, const char *reason)
 Starts processing closure. More...
 
void Stop (const char *file, int line, const char *reason)
 Yields the call combiner to the next closure in the queue, if any. More...
 
 ~CallCombiner ()
 

Private Member Functions

void ScheduleClosure (grpc_closure *closure, grpc_error_handle error)
 

Private Attributes

gpr_atm cancel_state_ = 0
 
MultiProducerSingleConsumerQueue queue_
 
gpr_atm size_ = 0
 

Detailed Description

Definition at line 50 of file call_combiner.h.

Constructor & Destructor Documentation

◆ CallCombiner()

grpc_core::CallCombiner::CallCombiner ( )

Definition at line 52 of file call_combiner.cc.

◆ ~CallCombiner()

grpc_core::CallCombiner::~CallCombiner ( )

Definition at line 61 of file call_combiner.cc.

Member Function Documentation

◆ Cancel()

void grpc_core::CallCombiner::Cancel ( grpc_error_handle  error)

Indicates that the call has been cancelled.

Definition at line 255 of file call_combiner.cc.

◆ ScheduleClosure()

void grpc_core::CallCombiner::ScheduleClosure ( grpc_closure closure,
grpc_error_handle  error 
)
private

Definition at line 103 of file call_combiner.cc.

◆ SetNotifyOnCancel()

void grpc_core::CallCombiner::SetNotifyOnCancel ( grpc_closure closure)

Registers closure to be invoked when Cancel() is called.

Once a closure is registered, it will always be scheduled exactly once; this allows the closure to hold references that will be freed regardless of whether or not the call was cancelled. If a cancellation does occur, the closure will be scheduled with the cancellation error; otherwise, it will be scheduled with GRPC_ERROR_NONE.

The closure will be scheduled in the following cases:

  • If Cancel() was called prior to registering the closure, it will be scheduled immediately with the cancelation error.
  • If Cancel() is called after registering the closure, the closure will be scheduled with the cancellation error.
  • If SetNotifyOnCancel() is called again to register a new cancellation closure, the previous cancellation closure will be scheduled with GRPC_ERROR_NONE.

If closure is NULL, then no closure will be invoked on cancellation; this effectively unregisters the previously set closure. However, most filters will not need to explicitly unregister their callbacks, as this is done automatically when the call is destroyed.

Definition at line 212 of file call_combiner.cc.

◆ Start()

void grpc_core::CallCombiner::Start ( grpc_closure closure,
grpc_error_handle  error,
const char *  file,
int  line,
const char *  reason 
)

Starts processing closure.

Definition at line 123 of file call_combiner.cc.

◆ Stop()

void grpc_core::CallCombiner::Stop ( const char *  file,
int  line,
const char *  reason 
)

Yields the call combiner to the next closure in the queue, if any.

Definition at line 163 of file call_combiner.cc.

Member Data Documentation

◆ cancel_state_

gpr_atm grpc_core::CallCombiner::cancel_state_ = 0
private

Definition at line 114 of file call_combiner.h.

◆ queue_

MultiProducerSingleConsumerQueue grpc_core::CallCombiner::queue_
private

Definition at line 110 of file call_combiner.h.

◆ size_

gpr_atm grpc_core::CallCombiner::size_ = 0
private

Definition at line 109 of file call_combiner.h.


The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:35