How do I cancel a timer?

Graham Leggett minfrin at sharp.fm
Fri Dec 19 12:00:53 CET 2008


ryah dahl wrote:

> libev is a performance-oriented library; since allocations can be a
> bottleneck and can be handled in many different ways, the library uses
> a common pattern and gives memory control to the user. Perhaps the
> user wants to allocate only a fixed number of watchers statically,
> perhaps they use a memory pool, or perhaps they just use malloc - all
> of these use cases are supported by ev_*_init.
> 
> The mistake checking you want could be added with very much overhead
> (keeping a list of all the pointers initialized, and adding a
> ev_*_deinit function? putting a checksum in the structure?), but that
> would negate the point of giving user memory control in the first
> place. Also, no one needs it because it's clear from the outset that
> managing watcher memory is the user's job.

I am not following what memory allocation has to do with this problem?

The problem that I am seeing is that if the same timer is initialised 
twice, an attempt to stop the timer does not cause the timer to stop.

In theory, it shouldn't matter how many times you init the timer, a stop 
should stop it.

Regards,
Graham
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3287 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20081219/88629680/attachment.bin>


More information about the libev mailing list