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: curl_easy_perform spawns a new thread

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 19 Jul 2022 11:24:53 +0200 (CEST)

On Tue, 19 Jul 2022, Thomas de Toulmon via curl-library wrote:

> I have the following issue in my code. I call curl_easy_perform (via the cpr
> library) and it spawns a new thread. I was able to verify that this is
> precisely the call to curl_easy_perform that spawns a new thread and
> terminates it before returning.
>
> Is there a way I can prevent this from happening? I.e. to have
> curl_easy_perform run in the current thread and prevent it from spawning a
> new thread?

If you use a libcurl built to use the threaded resolver (which is the default
one), libcurl will fire up a new thread for resolving names. That's a built-in
choice. The thread is only used for resolving names and nothing else.

You can opt to build libcurl with the stock synch resolver or with c-ares, but
those choices then come with other possible downsides.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-07-19