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

#include "split_statistics.h"

Inheritance diagram for net_instaweb::SplitVariable:
net_instaweb::Variable

List of all members.

Public Member Functions

 SplitVariable (Variable *rw, Variable *w)
virtual void Set (int64 new_value)
virtual int64 SetReturningPreviousValue (int64 new_value)
virtual int64 Get () const
virtual StringPiece GetName () const
virtual int64 Add (int delta)

Detailed Description

A statistics variable that forwards writes to two other Variable objects, but reads only from one.


Constructor & Destructor Documentation

Variable 'rw' will be used to read and write, variable 'w' will be used for writes only. Does not take ownership of either 'rw' or 'w'. 'rw' and 'w' must be non-NULL.


Member Function Documentation

virtual int64 net_instaweb::SplitVariable::Add ( int  delta) [virtual]

Adds 'delta' to the variable's value, returning the result. This is virtual so that subclasses can add platform-specific atomicity.

Reimplemented from net_instaweb::Variable.

virtual StringPiece net_instaweb::SplitVariable::GetName ( ) const [virtual]

Return some name representing the variable, provided that the specific implementation has some sensible way of doing so.

Implements net_instaweb::Variable.

virtual int64 net_instaweb::SplitVariable::SetReturningPreviousValue ( int64  value) [virtual]

Sets the specified value, returning the previous value. This can be used to by two competing threads/processes to deterimine which thread modified the value first. The default implementation is non-atomic, but implementations can override to provide an atomic version.

Non-atomic implementations may result in multiple concurrent updates each returning the old value. In an atomic implementation, only one concurrent update will return the old value.

Reimplemented from net_instaweb::Variable.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines