Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Andrew Stitcher
On Fri, 2018-07-20 at 12:52 -0400, Andrew Stitcher wrote: > I've now looked at the actual code! > > Things are a bit more complicated than I remembered: I forgot one semi-important difference between setupNextFireTime() and restart(). setupNextFireTime() is intended to be used for periodic

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Andrew Stitcher
I've now looked at the actual code! Things are a bit more complicated than I remembered: TimerTasks can have two different types of time to trigger them, a target absolute time ("at 3pm on 3 Jan 2016 UTC") and a relative time ("in 300ms"). You can only create one or the other of these TimerTask

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Andrew Stitcher
On Fri, 2018-07-20 at 11:27 -0400, Kim van der Riet wrote: > ... > I am using the timer in periodic mode, ie with period set to an > interval Thanks for describing what you are trying to do: As I mentioned earlier your case best matches the one-shot mode not the periodic mode. > ... > The idea

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Kim van der Riet
On 07/20/2018 11:04 AM, Gordon Sim wrote: On 20/07/18 15:50, Andrew Stitcher wrote: On Fri, 2018-07-20 at 10:47 -0400, Andrew Stitcher wrote: On Fri, 2018-07-20 at 15:44 +0100, Gordon Sim wrote: ... I believe Kim is using restart() but is debugging some issue where the task is postponed

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Gordon Sim
On 20/07/18 15:50, Andrew Stitcher wrote: On Fri, 2018-07-20 at 10:47 -0400, Andrew Stitcher wrote: On Fri, 2018-07-20 at 15:44 +0100, Gordon Sim wrote: ... I believe Kim is using restart() but is debugging some issue where the task is postponed after it has already fired, which he does not

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Andrew Stitcher
On Fri, 2018-07-20 at 10:47 -0400, Andrew Stitcher wrote: > On Fri, 2018-07-20 at 15:44 +0100, Gordon Sim wrote: > > ... > > I believe Kim is using restart() but is debugging some issue where > > the > > task is postponed after it has already fired, which he does not > > want > > (not sure why

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Andrew Stitcher
On Fri, 2018-07-20 at 15:44 +0100, Gordon Sim wrote: > ... > I believe Kim is using restart() but is debugging some issue where > the > task is postponed after it has already fired, which he does not want > (not sure why not). Is that right Kim? In that case I think you need to create a new

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Gordon Sim
On 20/07/18 15:42, Andrew Stitcher wrote: I think I can help shed some light on the original intention of these two methods: Essentially they are intended for different purposes: (As Gordon says) setUpNextFire() is intended only for use with periodic timers and is intended to be used to set up

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Andrew Stitcher
I think I can help shed some light on the original intention of these two methods: Essentially they are intended for different purposes: (As Gordon says) setUpNextFire() is intended only for use with periodic timers and is intended to be used to set up the next firing *after the time has just

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Kim van der Riet
On 07/20/2018 10:28 AM, Gordon Sim wrote: I thought what you wanted was a third option - a delay() - which would postpone the task to the full timeout again, but only if it had not already run. If so, that seems reasonable to me and should be easy to add. I think adding is safer than modifying

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Gordon Sim
On 20/07/18 15:18, Kim van der Riet wrote: On 07/20/2018 10:00 AM, Gordon Sim wrote: On 20/07/18 14:50, Kim van der Riet wrote: I agree that this is ambiguous. However, if the intent is to allow the timer to have period added for any state, why do we need setUpNextFire()? This idea seems

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Kim van der Riet
On 07/20/2018 10:00 AM, Gordon Sim wrote: On 20/07/18 14:50, Kim van der Riet wrote: I agree that this is ambiguous. However, if the intent is to allow the timer to have period added for any state, why do we need setUpNextFire()? This idea seems logically wrong. I believe setUpNextFire()

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Gordon Sim
On 20/07/18 14:50, Kim van der Riet wrote: I agree that this is ambiguous. However, if the intent is to allow the timer to have period added for any state, why do we need setUpNextFire()? This idea seems logically wrong. I believe setUpNextFire() was intended to be used by the Task subclass

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-20 Thread Kim van der Riet
I agree that this is ambiguous. However, if the intent is to allow the timer to have period added for any state, why do we need setUpNextFire()? This idea seems logically wrong. On 07/19/2018 03:32 PM, Gordon Sim wrote: The doxygen comment for the method states:     This can be called

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-19 Thread Gordon Sim
On 19/07/18 20:28, Gordon Sim wrote: On 19/07/18 16:11, Kim van der Riet wrote: The TimerTask class has two methods which change and/or set the time when the timer will fire. Both methods assume a timer period has been set when the task was originally created. setUpNextFire() is called

Re: [qpid-cpp] Inconsistent handling of qpid::sys::TimerTask setUpNextFire() and restart() methods

2018-07-19 Thread Gordon Sim
On 19/07/18 16:11, Kim van der Riet wrote: The TimerTask class has two methods which change and/or set the time when the timer will fire. Both methods assume a timer period has been set when the task was originally created. setUpNextFire() is called *after* the timer has already fired, and