[ https://issues.apache.org/jira/browse/MESOS-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13884691#comment-13884691 ]
Benjamin Mahler commented on MESOS-952: --------------------------------------- Alternatively, one could expect Clock::resume() to simply resume the clock, from where it is. The current behavior of Clock::resume() resets the clock back to real time, this to me feels like a reset function. I could imagine resume() as a complement to pause(), in that it simply resumes the forward advancement of time. Example: {noformat: title=current behavior} Clock::pause() // T = 0 Clock::advance(3) // T = 3 Clock::resume() // T = 0 // 1 second later, T = 1 {noformat} {noformat: title=alternate behavior} Clock::pause() // T = 0 Clock::advance(3) // T = 3 Clock::resume() // T = 3 // 1 second later, T = 4 {noformat} > Clock::resume should adjust timeouts that were created in a paused/advanced > Clock context. > ------------------------------------------------------------------------------------------ > > Key: MESOS-952 > URL: https://issues.apache.org/jira/browse/MESOS-952 > Project: Mesos > Issue Type: Bug > Reporter: Benjamin Mahler > > When timeouts are created while the Clock is paused and advanced into the > future, these must be adjusted once we resume the Clock. > For example: > Process A { > initialize() { loop(); } > loop() { delay(Seconds(1), loop); } > } > // T = 0 > Clock::pause(); > Clock::advance(Seconds(1)); // T = 1 > Clock::settle(); // The loop timeout will be expired, loop() is called. > // loop is scheduled for T = 2 > Clock::advance(Seconds(1)); // T = 2 > Clock::settle(); // The loop timeout will be expired, loop() is called. > // loop is scheduled for T = 3 > Clock::resume(); // T = 0 once again (assume ~ no real time has elapsed) > // Now loop will not be called for 3 seconds, until T = 3. > // Instead, we expect loop to be called at T = 1. > The semantics here can be quite tricky so please let me know if I'm missing > something. It seems we should be adjusting the timers when resuming an > advanced clock. -- This message was sent by Atlassian JIRA (v6.1.5#6160)