I have a background thread that starts and stops libcurl downloads using the 
"multi" interface.  It has a poll() loop that waits for something to happen on 
either one of libcurl's sockets or on a loopback socket that is used to 
interrupt poll().

After running for a bit, there is a periodic HTTP request we send.  When these 
start, libcurl calls our CURLMOPT_TIMERFUNCTION with a timeout of 0.  So the 
poll() loop starts polling with hot CPU.

The download then completes.  We curl_multi_remove_handle() then 
curl_easy_cleanup() in our handling of the curl_multi_info_read() messages.

However, at this point, even though libcurl has no active downloads on the 
multi handle, we never get a timer callback to set the timeout back to -1, so 
our poll() loop continues running hot.

Am I doing something wrong?  For now, I'm going to set the timeout to -1 when 
curl_multi_socket_action(CURL_SOCKET_TIMEOUT) returns 0 running handles to stop 
the thread running hot.

Thanks!

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to