cURL / Mailing Lists / curl-library / Single Mail

curl-library

Can't call curl_global_init from a thread -- understanding the architecture

From: K. Frank <kfrank29.c_at_gmail.com>
Date: Sat, 4 Oct 2014 16:55:40 -0400

Hello List!

Dan Fandrich commented in the thread:

   using libcurl in an enterprise application server

as follows:

   As documented, curl_global_init may not be called
   from a thread but from the main function before any
   threads are running.

First, do I understand correctly that if, say, I were to have
main() in a perfectly ordinary C program spawn a thread
(say, pthread_create), then it would be illegal for that thread
to call curl_global_init (even if no other thread in the program
were to call any curl functions)?

Second (assuming that the above is correct), what is the
architectural issue that makes it illegal for any thread but
the main() thread to call curl_global_init?

Thanks.

K. Frank
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-04