Public Member Functions | Private Member Functions | Private Attributes | List of all members
grpc::Alarm Class Reference

#include <alarm.h>

Inheritance diagram for grpc::Alarm:
Inheritance graph
[legend]

Public Member Functions

 Alarm ()
 Create an unset completion queue alarm. More...
 
 Alarm (Alarm &&rhs) noexcept
 Alarms are movable. More...
 
 Alarm (const Alarm &)=delete
 Alarms aren't copyable. More...
 
template<typename T >
 Alarm (grpc::CompletionQueue *cq, const T &deadline, void *tag)
 
void Cancel ()
 
Alarmoperator= (Alarm &&rhs) noexcept
 
Alarmoperator= (const Alarm &)=delete
 
template<typename T >
void Set (const T &deadline, std::function< void(bool)> f)
 
template<typename T >
void Set (grpc::CompletionQueue *cq, const T &deadline, void *tag)
 
 ~Alarm () override
 Destroy the given completion queue alarm, cancelling it in the process. More...
 

Private Member Functions

void SetInternal (gpr_timespec deadline, std::function< void(bool)> f)
 
void SetInternal (grpc::CompletionQueue *cq, gpr_timespec deadline, void *tag)
 
- Private Member Functions inherited from grpc::GrpcLibraryCodegen
 GrpcLibraryCodegen (bool call_grpc_init=true)
 
virtual ~GrpcLibraryCodegen ()
 

Private Attributes

grpc::internal::CompletionQueueTagalarm_
 

Detailed Description

Definition at line 35 of file grpcpp/alarm.h.

Constructor & Destructor Documentation

◆ Alarm() [1/4]

grpc::Alarm::Alarm ( )

Create an unset completion queue alarm.

Definition at line 138 of file alarm.cc.

◆ ~Alarm()

grpc::Alarm::~Alarm ( )
override

Destroy the given completion queue alarm, cancelling it in the process.

Definition at line 161 of file alarm.cc.

◆ Alarm() [2/4]

template<typename T >
grpc::Alarm::Alarm ( grpc::CompletionQueue cq,
const T deadline,
void *  tag 
)
inline

DEPRECATED: Create and set a completion queue alarm instance associated to cq. This form is deprecated because it is inherently racy.

Definition at line 51 of file grpcpp/alarm.h.

◆ Alarm() [3/4]

grpc::Alarm::Alarm ( const Alarm )
delete

Alarms aren't copyable.

◆ Alarm() [4/4]

grpc::Alarm::Alarm ( Alarm &&  rhs)
inlinenoexcept

Alarms are movable.

Definition at line 73 of file grpcpp/alarm.h.

Member Function Documentation

◆ Cancel()

void grpc::Alarm::Cancel ( )

Cancel a completion queue alarm. Calling this function over an alarm that has already fired has no effect.

Definition at line 167 of file alarm.cc.

◆ operator=() [1/2]

Alarm& grpc::Alarm::operator= ( Alarm &&  rhs)
inlinenoexcept

Definition at line 74 of file grpcpp/alarm.h.

◆ operator=() [2/2]

Alarm& grpc::Alarm::operator= ( const Alarm )
delete

◆ Set() [1/2]

template<typename T >
void grpc::Alarm::Set ( const T deadline,
std::function< void(bool)>  f 
)
inline

Set an alarm to invoke callback f. The argument to the callback states whether the alarm expired at deadline (true) or was cancelled (false)

Definition at line 88 of file grpcpp/alarm.h.

◆ Set() [2/2]

template<typename T >
void grpc::Alarm::Set ( grpc::CompletionQueue cq,
const T deadline,
void *  tag 
)
inline

Trigger an alarm instance on completion queue cq at the specified time. Once the alarm expires (at deadline) or it's cancelled (see Cancel), an event with tag tag will be added to cq. If the alarm expired, the event's success bit will be true, false otherwise (ie, upon cancellation).

Definition at line 64 of file grpcpp/alarm.h.

◆ SetInternal() [1/2]

void grpc::Alarm::SetInternal ( gpr_timespec  deadline,
std::function< void(bool)>  f 
)
private

Definition at line 152 of file alarm.cc.

◆ SetInternal() [2/2]

void grpc::Alarm::SetInternal ( grpc::CompletionQueue cq,
gpr_timespec  deadline,
void *  tag 
)
private

Definition at line 142 of file alarm.cc.

Member Data Documentation

◆ alarm_

grpc::internal::CompletionQueueTag* grpc::Alarm::alarm_
private

Definition at line 96 of file grpcpp/alarm.h.


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


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