MCPcopy Create free account
hub / github.com/apache/mesos / next

Function next

3rdparty/libprocess/src/clock.cpp:88–106  ·  view source on GitHub ↗

Helper for determining the time when the next timer elapses, or None if no timers are pending, or the clock is paused and no timers are expired. Note that we don't manipulate 'timers' directly so that it's clear from the callsite that the use of 'timers' is within a 'synchronized' block. TODO(benh): Create a generic 'Timers' abstraction which hides this and more away (i.e., all manipulations of '

Source from the content-addressed store, hash-verified

86// TODO(benh): Create a generic 'Timers' abstraction which hides this
87// and more away (i.e., all manipulations of 'timers' below).
88Option<Time> next(const map<Time, list<Timer>>& timers)
89{
90 if (!timers.empty()) {
91 Time first = timers.begin()->first;
92
93 // If the clock is paused and no timers are expired, the
94 // timers cannot fire until the clock is advanced, so we
95 // return None() here. Note that we pass nullptr to ensure
96 // that this looks at the global clock, since this can be
97 // called from a Process context through Clock::timer.
98 if (Clock::paused() && first > Clock::now(nullptr)) {
99 return None();
100 }
101
102 return first;
103 }
104
105 return None();
106}
107
108
109// Forward declaration for scheduleTick.

Callers 4

handleMethod · 0.70
waitedMethod · 0.70
streamMethod · 0.70
scheduleTickFunction · 0.70

Calls 3

NoneClass · 0.85
emptyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected