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

#include "named_lock_tester.h"

Public Member Functions

 NamedLockTester (ThreadSystem *thread_system)
bool TryLock (NamedLock *lock)
bool LockTimedWaitStealOld (int64 wait_ms, int64 steal_ms, NamedLock *lock)
bool LockTimedWait (int64 wait_ms, NamedLock *lock)
bool UnlockWithDelete (NamedLock *old_lock, NamedLock *new_lock)
bool StealWithDelete (int64 steal_ms, NamedLock *old_lock, NamedLock *new_lock)
 As for UnlockWithDelete, but for a steal. Frees both locks. More...
void DeleteLock ()
void Quiesce ()
void set_quiesce (Function *quiesce)

Detailed Description

The NamedLock class does not have any blocking operations in it, as they don't fit well with PageSpeed's asynchronous archicture and with plans to make an asynchronous lock manager. However, in the context of unit tests, it is convenient to assume a blocking or schedule-based lock manager, and check that the call completes.

Member Function Documentation

void net_instaweb::NamedLockTester::set_quiesce ( Function quiesce)

Sets a function to be called after calling an asynchronous locking method, prior to testing acuisition status. Onwership of this function transfers to this class.

bool net_instaweb::NamedLockTester::StealWithDelete ( int64  steal_ms,
NamedLock old_lock,
NamedLock new_lock 

As for UnlockWithDelete, but for a steal. Frees both locks.


bool net_instaweb::NamedLockTester::UnlockWithDelete ( NamedLock old_lock,
NamedLock new_lock 

Tests the specific case where the callback for new_lock deletes old_lock. The likely failure case is a SEGV, though you must verify a true return code or the test didn't run. Frees both locks.


< Long enough to ensure it doesn't timeout.

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