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.

how to stop curl_easy_perform() from another thread

From: Winnie Poon via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 16 Oct 2020 20:11:28 +0000

Hi,

I need a proper solution to cancel curl_easy_perform that is running on a separate thread. My initial approach was to save the handle, then on the main thread, try to interfere it by , e.g.

curl_easy_setopt(m_sseHandle, CURLOPT_TIMEOUT_MS, 1);

It did work, but then i read below it's unsafe to access the same handle across different threads.

Are the points in this posting (from 13 years ago) still valid?

https://curl.haxx.se/mail/lib-2007-09/0097.html
Curl: Re: how to stop curl_easy_perform()<https://curl.haxx.se/mail/lib-2007-09/0097.html>
From: Daniel Stenberg <daniel_at_haxx.se> Date: Thu, 13 Sep 2007 15:54:15 +0200 (CEST). On Thu, 13 Sep 2007, Dragos MOINESCU wrote: (Please don't reply to an existing mail as a shortcut to start a new thread. Modern mail clients and the web archives etc all use threading information
curl.haxx.se

Questions:

  * is it still unsafe to use the same handle in more than 1 thread?
  * is the progress callback the only proper way to cancel curl_easy_perform? It works, but there's overhead of the callback being triggered every second.

Please advise, i very much need a solution soon. Thank you so much for your attention.

Regards,
Winnie


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-10-16