On Tue, Dec 16, 2008 at 01:11:24PM +0200, Graham Leggett <minf...@sharp.fm> 
wrote:
> What I found I had done was initialised the timer twice. It seems that  

You can initialise the timer as many times as you want, as long as it isn't
started.

Although this is completely obvious (when you start a timer, obviously you
can't just reinitialise the memory it uses), this is also mentioned very
strongly in the manual.

> when this happens you have to stop the timer twice, or a single stop of  
> the timer isn't effective.

No, you simply have a bug in that case - you must not wipe out data
structures that are in use, obviously.

>> But remember, creation and destruction _for watchers_ is completely
>> outside the libev API, only _event loops_ can be created and destructed.
>
> What I meant by "destroy a timer" is "make sure this callback is never  
> executed, because the memory beneath this is about to be freed".

stopping it, as documented, will do that.

> At the moment, I am using ev_timer_stop() for this, and as long as I  
> don't initialise the same timer twice, it seems to work.

you can initialise the timer as many times as you want. you should find
the bug in your code where you initialise a *running* timer again, which
of course overwrites the data structures that are already in use.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      p...@goof.com
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to