class SyntheticTimer
Defined at line 23 of file ../../src/media/audio/lib/clock/synthetic_timer.h
An implementation of Timer that is controlled by a SyntheticClockRealm. Once a thread blocks in
SleepUntil(T), it does not unblock until receiving a call to AdvanceTo(T') where `T' >= T`.
This class is thread safe.
Public Methods
std::shared_ptr<SyntheticTimer> Create (zx::time mono_start_time)
static
Defined at line 14 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
void SetShutdownBit ()
Implementation of Timer.
Defined at line 28 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
void SetEventBit ()
Defined at line 23 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
WakeReason SleepUntil (zx::time deadline)
Defined at line 33 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
void Stop ()
Defined at line 66 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
void WaitUntilSleepingOrStopped ()
Blocks until stopped or until a thread is blocked in SleepUntil. This is intended to be used
from SyntheticClockRealm using code like:
```
void AdvanceTo(when) {
while (now_
<
when) {
for (auto
&
t : timers) {
t.WaitUntilSleepingOrStopped();
}
// Use SyntheticTimer::CurrentState to compute the next deadline and check
// if any events are pending, then advance to the next deadline.
}
}
```
May be called from any thread.
Defined at line 72 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
void AdvanceTo (zx::time t)
Advances to the given system monotonic time. If a thread is currently blocked in
`SleepUntil(deadline)` with `deadline
<
= t`, the blocked thread is woken. If called with `t
<
deadline`, the blocked thread will be woken iff there is a pending signal.
May be called from any thread.
REQUIRES: currently sleeping and t >= now.
Defined at line 78 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
State CurrentState ()
Reports the current state of this timer.
May be called from any thread, however to ensure the state is not changing
concurrently, this should not be called unless all threads are blocked. See
example in the class comments.
Defined at line 109 of file ../../src/media/audio/lib/clock/synthetic_timer.cc
zx::time now ()
The current system monotonic time.
Defined at line 119 of file ../../src/media/audio/lib/clock/synthetic_timer.cc