Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
net_instaweb::CondvarTestBase Class Reference

List of all members.

Protected Types

typedef void(ThreadSystem::Condvar::* SignalMethod )()

Protected Member Functions

void Init (ThreadSystem::CondvarCapableMutex *mutex, ThreadSystem::Condvar *startup_condvar, ThreadSystem::Condvar *condvar)
virtual void CreateHelper ()=0
virtual void FinishHelper ()=0
void StartHelper ()
virtual void HelperThreadMethod ()
void StartupTest ()
 Below are the common tests that should be run by every client.
void BlindSignalsTest ()
void PingPongTest ()
void TimeoutTest ()
 Make sure that TimedWait eventually progresses in the absence of a signal.
void LongTimeoutTest (int wait_ms)
 Make sure that a long timeout doesn't exit too early.
void TimeoutPingPongTest ()
virtual Timertimer ()=0

Static Protected Member Functions

static void * HelperThread (void *data)

Protected Attributes

ThreadSystem::CondvarCapableMutexmutex_
ThreadSystem::Condvarstartup_condvar_
ThreadSystem::Condvarcondvar_
bool ready_to_start_
int iters_
int current_iter_
SignalMethod signal_method_
bool wait_after_signal_
int helper_increments_
bool init_called_

Member Function Documentation

Run the helper without interacting with it. Also run with signal_method_ = &ThreadSystem::Condvar::Broadcast

virtual void net_instaweb::CondvarTestBase::CreateHelper ( ) [protected, pure virtual]

CreateHelper creates a thread that ultimately calls this->HelperThreadMethod(), most simply by invoking HelperThread(this). It runs this method to completion, and then terminates gracefully.

virtual void net_instaweb::CondvarTestBase::FinishHelper ( ) [protected, pure virtual]

FinishHelper is called in the main thread to wait for graceful termination of the thread created by CreateHelper.

virtual void net_instaweb::CondvarTestBase::HelperThreadMethod ( ) [inline, protected, virtual]

We must hold the mutex to access the iteration count and check the loop condition.

void net_instaweb::CondvarTestBase::Init ( ThreadSystem::CondvarCapableMutex mutex,
ThreadSystem::Condvar startup_condvar,
ThreadSystem::Condvar condvar 
) [inline, protected]

Init is intended to be called from the constructor of the derived class. Ownership of the objects remains with the caller.

void net_instaweb::CondvarTestBase::LongTimeoutTest ( int  wait_ms) [inline, protected]

Make sure that a long timeout doesn't exit too early.

This test should not be flaky even if it runs slowly, as we are not placing an *upper* bound on the lock duration.

void net_instaweb::CondvarTestBase::PingPongTest ( ) [inline, protected]

Use condvars to pass control back and forth between worker and main thread. Also run with signal_method_ = &ThreadSystem::Condvar::Broadcast

We must hold the mutex to access the iteration count and check the loop condition.

void net_instaweb::CondvarTestBase::StartupTest ( ) [inline, protected]

Below are the common tests that should be run by every client.

Make sure we can start and stop the helper gracefully.

Use condvars to pass control back and forth between worker and main thread. Final interaction will be one-sided and will time out. Also run with signal_method_ = &ThreadSystem::Condvar::Broadcast

We must hold the mutex to access the iteration count and check the loop condition. Note that in case of timeout we might get here with current_iter_ % 2 == 0, so we might perform more local increments than we expect.

void net_instaweb::CondvarTestBase::TimeoutTest ( ) [inline, protected]

Make sure that TimedWait eventually progresses in the absence of a signal.

< This will deadlock if we don't time out.


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