Closed ubiqoracle closed 4 years ago
The RestClient::init() and RestClient::disable() methods basically correspond to curl_global_init and curl_global_cleanup and thus need to be called right at the beginning of your program and before shutdown respectively. These set up the environment and are not thread-safe.
This is from the docs. The methods need to be called outside of any threading at the start of the program. Let me know if there is a way to make the docs more clear.
Expected behaviour (not thread-safe)
I found Thread Safety on the top page. I tried RestClient::init() before restclient-cpp GET PUT in multi-threading to produce thread-not-safe.
Should I put RestClient::init() in each thread or init() once before multi-threads? Is it possible to provide a sample code (multi-threads) to show it's not thread-safe? so we can use it with caution in multi-threads.
Actual behaviour
it went through without thread-not-safe
Environment and debugging details
compiler and version (g++ -std=c++11)
operating system (ubuntu 18.4)
version of restclient-cpp (2.1.1)
how did you install restclient-cpp? (via packages, git, tarball) git commit eeb00a837e0ed54e358d67a31ef78e40ee7d860f (HEAD, origin/master, origin/HEAD, master) Merge: e7824f4 b3f7e2b Author: Daniel Schauenberg d@unwiredcouch.com Date: Tue Mar 3 14:30:42 2020 +0100
libcurl version and compile flags curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
full error output of your build as an inline codeblock or gist n/a