Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions
net_instaweb::MockScheduler Class Reference

#include "mock_scheduler.h"

Inheritance diagram for net_instaweb::MockScheduler:
net_instaweb::Scheduler

List of all members.

Public Member Functions

 MockScheduler (ThreadSystem *thread_system, MockTimer *timer)
virtual void RegisterWorker (QueuedWorkerPool::Sequence *w)
virtual void UnregisterWorker (QueuedWorkerPool::Sequence *w)
void AwaitQuiescence ()
 Blocks until all work in registered workers is done.
void AdvanceTimeMs (int64 timeout_ms)
void AdvanceTimeUs (int64 timeout_us)
void SetTimeUs (int64 time_us)

Protected Member Functions

virtual void AwaitWakeupUntilUs (int64 wakeup_time_us)

Detailed Description

Implements a Scheduler where time is virtualized, and TimedWait blocks the thread until mock-time is advanced.

The TimedWait implemention employs the worker's idle_callback to signal the underlying condition variable when the requested time has passed.


Member Function Documentation

void net_instaweb::MockScheduler::AdvanceTimeMs ( int64  timeout_ms) [inline]

Similar to BlockingTimedWaitUs but takes the lock for convenience. Must be called without mutex held.

virtual void net_instaweb::MockScheduler::AwaitWakeupUntilUs ( int64  wakeup_time_us) [protected, virtual]

Internal method to await a wakeup event. Block until wakeup_time_us (an absolute time since the epoch), or until something interesting (such as a call to Signal) occurs. This is virtual to permit us to mock it out (the mock simply advances time). This maybe called with 0 in case where there are no timers currently active.

Reimplemented from net_instaweb::Scheduler.

These methods notify the scheduler of work sequences that may run work on it. They are only used for time simulations in MockScheduler and are no-ops during normal usage.

Reimplemented from net_instaweb::Scheduler.

void net_instaweb::MockScheduler::SetTimeUs ( int64  time_us)

Sets the current absolute time using absolute numbers. Must be called without mutex held.


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