Page Speed Optimization Libraries
1.4.26.1
|
Public Member Functions | |
virtual int64 | SetReturningPreviousValue (int64 value) |
virtual void | Set (int64 value)=0 |
virtual int64 | Get () const =0 |
virtual StringPiece | GetName () const =0 |
virtual int64 | Add (int delta) |
void | Clear () |
virtual int64 net_instaweb::Variable::Add | ( | int | delta | ) | [inline, virtual] |
Adds 'delta' to the variable's value, returning the result. This is virtual so that subclasses can add platform-specific atomicity.
Reimplemented in net_instaweb::SharedMemVariable, net_instaweb::SplitVariable, and net_instaweb::SimpleStatsVariable.
virtual StringPiece net_instaweb::Variable::GetName | ( | ) | const [pure virtual] |
Return some name representing the variable, provided that the specific implementation has some sensible way of doing so.
Implemented in net_instaweb::SharedMemVariable, net_instaweb::SplitVariable, net_instaweb::SimpleStatsVariable, and net_instaweb::NullStatisticsVariable.
virtual int64 net_instaweb::Variable::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 in net_instaweb::SharedMemVariable, and net_instaweb::SplitVariable.