How do I cancel a timer?
schmorp at schmorp.de
Mon Dec 15 21:59:46 CET 2008
On Mon, Dec 15, 2008 at 06:34:10PM +0200, Graham Leggett <minfrin at sharp.fm> wrote:
> Can someone confirm first of all for me that ev_timer_stop is the
> correct way to cancel a timer?
Yes - are you sure you don't start it again, or modify it in illegal ways?
> The docs make no mention of how you destroy a timer, only how you might
> create one or reset one.
Because destruction is on your side of the API - libev has no facilities
to create or destroy timers, that's what the application does.
The documentation mentions exactly, however, when you can safely reuse the
watcher structure for something else, which is what you seem to want.
But remember, creation and destruction _for watchers_ is completely
outside the libev API, only _event loops_ can be created and destructed.
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