#include "mock_scheduler.h"
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. | |
Protected Member Functions | |
virtual void | AwaitWakeupUntilUs (int64 wakeup_time_us) |
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.
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.
virtual void net_instaweb::MockScheduler::RegisterWorker | ( | QueuedWorkerPool::Sequence * | w | ) | [virtual] |
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.