How do I cancel a timer?
schmorp at schmorp.de
Thu Dec 18 17:13:01 CET 2008
On Wed, Dec 17, 2008 at 01:02:07PM +0200, Graham Leggett <minfrin at sharp.fm> wrote:
> If a timer that has been started is reinitialised, I would expect it to
> either a) abort/assert with an error, or b) remove the first timer
> cleanly before reinitialising it.
You better adjust your expectations quickly, as you will run into the same
problem with about any other software.
The problem with your expectation is that it cannot be done, at all: To
do what you want one would have to rely on the _existing_ contents of the
memory area, i.e. it has to be _initialised_ already to some known values.
That's a hen and egg problem: to initialise some memory area, you cannot
rely on it. If you want to rely on it, you have to initialise it first,
presumably with... an initialisation function that doesn't rely on its
The only way around that would be another checking layer, much like a
memory checker, that checked your initialisation request for validity, by
having a shadow data structure to check against, which is obviously not
> Right now the behaviour is that the timer stop is ignored, and that is
> looks broken to me.
Well, so trust somebody with experience: your expectation is bogus, just
think about how you would implement that and it should become all clear.
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / pcg at goof.com
More information about the libev