Page Speed Optimization Libraries  1.6.29.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::QueuedAlarm Class Reference

#include "queued_alarm.h"

List of all members.

Public Member Functions

 QueuedAlarm (Scheduler *scheduler, QueuedWorkerPool::Sequence *sequence, int64 wakeup_time_us, Function *callback)
void CancelAlarm ()

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,
QueuedWorkerPool::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

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines