| 321 | |
| 322 | |
| 323 | void Clock::pause() |
| 324 | { |
| 325 | process::initialize(); // To make sure the event loop is ready. |
| 326 | |
| 327 | synchronized (timers_mutex) { |
| 328 | if (!clock::paused) { |
| 329 | *clock::initial = *clock::current = now(); |
| 330 | clock::paused = true; |
| 331 | VLOG(2) << "Clock paused at " << *clock::initial; |
| 332 | |
| 333 | // When the clock is paused, we clear the scheduled 'ticks' |
| 334 | // since they no longer accurately represent when a 'tick' |
| 335 | // will fire (our notion of "time" is now moving differently |
| 336 | // from that of the event loop). Note that only 'ticks' |
| 337 | // that fire immediately will be scheduled while the clock |
| 338 | // is paused. |
| 339 | clock::ticks->clear(); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | // Note that after pausing the clock, the existing scheduled |
| 344 | // 'ticks' might still fire, but since 'paused' == true no "time" |
| 345 | // will actually have passed, so no timer will actually fire. |
| 346 | } |
| 347 | |
| 348 | |
| 349 | bool Clock::paused() |
nothing calls this directly
no test coverage detected