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

#include "statistics.h"

Inheritance diagram for net_instaweb::MutexedScalar:
net_instaweb::SharedMemVariable net_instaweb::SimpleStatsVariable

Public Member Functions

int64 Get () const
void Set (int64 value)
int64 SetReturningPreviousValue (int64 value)
int64 AddHelper (int64 delta)

Protected Member Functions

virtual AbstractMutexmutex () const =0
virtual int64 GetLockHeld () const =0
 Get/Setters that may only be called if you already hold the mutex.
virtual int64 SetReturningPreviousValueLockHeld (int64 value)=0
void SetLockHeld (int64 value)
int64 AddLockHeld (int64 delta)


class StatisticsLogger

Detailed Description

Scalar value protected by a mutex. Mutex must fully protect access to underlying scalar. For example, in mod_pagespeed and ngx_pagespeed, variables are stored in shared memory and accessible from any process on a machine, so the mutex must provide protection across separate processes.

StatisticsLogger depends upon these mutexes being cross-process so that several processes using the same file system don't clobber each others logs.

TODO(jmarantz): this could be done using templates rather than using virtual methods, as MutexedScalar does not implement an abstract interface.

Member Function Documentation

int64 net_instaweb::MutexedScalar::Get ( ) const

Subclasses should not define these methods, instead define the *LockHeld() methods below.

void net_instaweb::MutexedScalar::SetLockHeld ( int64  value)

These are implemented based on GetLockHeld() and SetReturningPreviousLockHeld().

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