EventDispatcher: fix a few tricky cases regarding Timers

Authored by ahartmetz on Jun 17 2017, 1:39 PM.

Description

EventDispatcher: fix a few tricky cases regarding Timers

  • Do not compare pointers to a Timer that may have been deleted. A different Timer may have been allocated at the same memory address. This failed at least when the new timer (or, in fact, the current timer) had the timeout changed since removing it. There may have been different failure cases, too.
  • Make timeToNextDueTimer() always safe to call from the listener of the currently triggered timer, even after the has been removed from its triggered handler. The way it is done is safe against the problem described above.
  • Do not look at the currently triggered timer in addTimer(); it might have been deleted already.

With a new test that was very helpful in finding and fixing the
issues.

Details

Committed
ahartmetzAug 31 2017, 7:34 PM
Parents
R738:382acb941e1b: Include what you use for MallocCache
Branches
Unknown
Tags
Unknown