curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Problem where timer callback keeps setting a 0 timer

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 4 Dec 2019 08:25:37 +0100 (CET)

On Wed, 4 Dec 2019, Sean Burford via curl-library wrote:

> Reading the man page
> <https://curl.haxx.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html>, it looks like
> calls to the timer function request a single shot timer. Your description
> makes it sound like you set up a periodic timer that fires every timeout_ms
> milliseconds. It shouldn't be necessary for curl to provide a -1
> cancellation because the timer was meant to be a single shot, it's only
> specified to fire once.

That's exactly right. The man page calls it "a non-repeating timer". A timeout
value 0 then means fire ONCE right away. -1 means cancel the current existing
timer and all other (positive) values means fire off a single-time timer in
this many milliseconds.

> The example on the man page may be a source of confusion.

Yah, I'm not overly happy with that one. If someone can come up with a nicer
and cleaner example to use there, I'm interested!

-- 
  / daniel.haxx.se | Get the best commercial curl support there is - from me
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-12-04