Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::QueuedAlarm Class Reference

#include "queued_alarm.h"

Inheritance diagram for net_instaweb::QueuedAlarm:
net_instaweb::Function

Public Member Functions

 QueuedAlarm (Scheduler *scheduler, Sequence *sequence, int64 wakeup_time_us, Function *callback)
 
void CancelAlarm ()
 
- Public Member Functions inherited from net_instaweb::Function
void set_quit_requested_pointer (AtomicBool *x)
 
bool quit_requested () const
 
void CallRun ()
 
void CallCancel ()
 
void set_delete_after_callback (bool x)
 
void Reset ()
 

Additional Inherited Members

- Protected Member Functions inherited from net_instaweb::Function
virtual void Cancel ()
 

Detailed Description

A helper for managing alarms that need to both run in a sequence and be cancellable (in the CancelAlarm sense) safely; note that QueuedWorkerPool::Sequence::AddFunction does not provide alarm awareness.

Constructor & Destructor Documentation

net_instaweb::QueuedAlarm::QueuedAlarm ( Scheduler scheduler,
Sequence sequence,
int64  wakeup_time_us,
Function callback 
)

Schedules a function to run at a given time in a given sequence. (Note that the function's invocation may be delayed by other work present in the sequence at time of alarm going off).

This constructor must be invoked from that sequence as well.

The object will be destroyed automatically when either the callback is invoked or the cancellation is complete. You should not free the sequence until one of these points is reached.

Member Function Documentation

void net_instaweb::QueuedAlarm::CancelAlarm ( )

Cancels the alarm. This method must be run from the sequence given to the constructor; and should not be called when the callback has already been invoked. It is suggested that as both invocations of CancelAlarm and the callback are deallocation points that you defensively clear any pointers to the QueuedAlarm object when they occur.

The function's Cancel method will be invoked; but no guarantee is made as to when or in what thread context. The class does guarantee, however, that it will not access the sequence_ once CancelAlarm() completes.


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