]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
version: rename threadsafe-init to threadsafe
authorViktor Szakats <commit@vsz.me>
Mon, 13 Jun 2022 18:59:45 +0000 (18:59 +0000)
committerViktor Szakats <commit@vsz.me>
Mon, 13 Jun 2022 18:59:45 +0000 (18:59 +0000)
Referring to Daniel's article [1], making the init function thread-safe
was the last bit to make libcurl thread-safe as a whole. So the name of
the feature may as well be the more concise 'threadsafe', also telling
the story that libcurl is now fully thread-safe, not just its init
function. Chances are high that libcurl wants to remain so in the
future, so there is little likelihood of ever needing any other distinct
`threadsafe-<name>` feature flags.

For consistency we also shorten `CURL_VERSION_THREADSAFE_INIT` to
`CURL_VERSION_THREADSAFE`, update its description and reference libcurl's
thread safety documentation.

[1]: https://daniel.haxx.se/blog/2022/06/08/making-libcurl-init-more-thread-safe/

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #8989

RELEASE-NOTES
configure.ac
docs/libcurl/curl_global_init.3
docs/libcurl/curl_version_info.3
docs/libcurl/symbols-in-versions
include/curl/curl.h
lib/version.c
packages/OS400/curl.inc.in
src/tool_help.c
tests/libtest/lib3026.c

index e7b998f7e73a70e757c84b782efb08d605a3cd78..42f5f9545c6f63d2ba747d2781ff1005d7409a77 100644 (file)
@@ -10,7 +10,7 @@ This release includes the following changes:
 
  o curl: add --rate to set max request rate per time unit [69]
  o curl: deprecate --random-file and --egd-file [12]
- o curl_version_info: add CURL_VERSION_THREADSAFE_INIT [100]
+ o curl_version_info: add CURL_VERSION_THREADSAFE [100]
  o CURLINFO_CAPATH/CAINFO: get the default CA paths from libcurl [9]
  o lib: make curl_global_init() threadsafe when possible [101]
  o libssh2: add CURLOPT_SSH_HOSTKEYFUNCTION [78]
index 359384322d8131225012f5a588687d9df3419cea..79ff336fe2bf63664984e8d12c722f257a115759 100644 (file)
@@ -4262,7 +4262,7 @@ if test ${ac_cv_sizeof_curl_off_t} -gt 4; then
 fi
 
 if test "$tst_atomic" = "yes"; then
-  SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe-init"
+  SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe"
 else
   AC_COMPILE_IFELSE([
     AC_LANG_PROGRAM([[
@@ -4273,7 +4273,7 @@ else
       #endif
     ]])
   ],[
-     SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe-init"
+     SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe"
   ],[
   ])
 fi
index 4d2e4ebda7a4e08761b2bedb147b5eb47cac0f4e..de0251e2c1e07d5d25fc73fe82ca1e5f6c98ac3b 100644 (file)
@@ -47,7 +47,7 @@ value unless you are familiar with it and mean to control internal operations
 of libcurl.
 
 This function is thread-safe since libcurl 7.84.0 if
-\fIcurl_version_info(3)\fP has CURL_VERSION_THREADSAFE_INIT feature bit set
+\fIcurl_version_info(3)\fP has CURL_VERSION_THREADSAFE feature bit set
 (most platforms).
 
 If this is not thread-safe, you must not call this function when any other
index b253a5e21448ee0ca9c90a4e147ce6e44f9f976f..2a27c999e4a463ec731401175a761581aa970985 100644 (file)
@@ -206,9 +206,10 @@ libcurl was built with support for SSPI. This is only available on Windows and
 makes libcurl use Windows-provided functions for Kerberos, NTLM, SPNEGO and
 Digest authentication. It also allows libcurl to use the current user
 credentials without the app having to pass them on. (Added in 7.13.2)
-.IP CURL_VERSION_THREADSAFE_INIT
+.IP CURL_VERSION_THREADSAFE
 libcurl was built with thread-safety support (Atomic or SRWLOCK) to protect
 curl initialisation. (Added in 7.84.0)
+See \fIlibcurl-thread(3)\fP
 .IP CURL_VERSION_TLSAUTH_SRP
 libcurl was built with support for TLS-SRP (in one or more of the built-in TLS
 backends). (Added in 7.21.4)
index 2368255d4ff50083e27b5baa1d5effced03fd346..c590d084f1ae7f9cc9389d607cce90bb3df6f5f9 100644 (file)
@@ -172,7 +172,7 @@ CURL_VERSION_PSL                7.47.0
 CURL_VERSION_SPNEGO             7.10.8
 CURL_VERSION_SSL                7.10
 CURL_VERSION_SSPI               7.13.2
-CURL_VERSION_THREADSAFE_INIT    7.84.0
+CURL_VERSION_THREADSAFE         7.84.0
 CURL_VERSION_TLSAUTH_SRP        7.21.4
 CURL_VERSION_UNICODE            7.72.0
 CURL_VERSION_UNIX_SOCKETS       7.40.0
index 61670ee51443a74a0fc9a8da63342f8d4076719e..b00648e791ebf7beef4a5cd232a9dab2708f40ec 100644 (file)
@@ -2611,7 +2611,7 @@ CURL_EXTERN void curl_free(void *p);
  * curl_global_init() should be invoked exactly once for each application that
  * uses libcurl and before any call of other libcurl functions.
 
- * This function is thread-safe if CURL_VERSION_THREADSAFE_INIT is set in the
+ * This function is thread-safe if CURL_VERSION_THREADSAFE is set in the
  * curl_version_info_data.features flag (fetch by curl_version_info()).
 
  */
@@ -3030,8 +3030,7 @@ typedef struct curl_version_info_data curl_version_info_data;
 #define CURL_VERSION_UNICODE      (1<<27) /* Unicode support on Windows */
 #define CURL_VERSION_HSTS         (1<<28) /* HSTS is supported */
 #define CURL_VERSION_GSASL        (1<<29) /* libgsasl is supported */
-#define CURL_VERSION_THREADSAFE_INIT (1<<30) /* curl_global_init/cleanup() are
-                                                thread-safe */
+#define CURL_VERSION_THREADSAFE   (1<<30) /* libcurl API is thread-safe */
 
  /*
  * NAME curl_version_info()
index ba957dcdec961f65f117b1735734dbe048fffdb1..4672182d5027e5711d023267e93cd356d2d4875e 100644 (file)
@@ -455,7 +455,7 @@ static curl_version_info_data version_info = {
   | CURL_VERSION_GSASL
 #endif
 #if defined(GLOBAL_INIT_IS_THREADSAFE)
-  | CURL_VERSION_THREADSAFE_INIT
+  | CURL_VERSION_THREADSAFE
 #endif
   ,
   NULL, /* ssl_version */
index 520d3734248507c1b7b6e620726e96aa19e4d52d..390c7d0514fefd660d0e2bc5c8c440939d4e426a 100644 (file)
      d                 c                   X'10000000'
      d CURL_VERSION_GSASL...
      d                 c                   X'20000000'
-     d CURL_VERSION_THREADSAFE_INIT...
+     d CURL_VERSION_THREADSAFE...
      d                 c                   X'40000000'
       *
      d CURL_HTTPPOST_FILENAME...
index b792b55ac6fd052537c58e084833b6c6f4bd8c68..75400d94c16b7fe1ba971daa5a73bc7907033b34 100644 (file)
@@ -112,7 +112,7 @@ static const struct feat feats[] = {
   {"alt-svc",        CURL_VERSION_ALTSVC},
   {"HSTS",           CURL_VERSION_HSTS},
   {"gsasl",          CURL_VERSION_GSASL},
-  {"threadsafe-init",CURL_VERSION_THREADSAFE_INIT},
+  {"threadsafe",     CURL_VERSION_THREADSAFE},
 };
 
 static void print_category(curlhelp_t category)
index 8c4a34de91c57d989856da68dcc6154692d98cdf..43fe33529e1f00d06c31dc7bc61911a07a1ef672 100644 (file)
@@ -53,9 +53,9 @@ int test(char *URL)
   (void) URL;
 
   ver = curl_version_info(CURLVERSION_NOW);
-  if((ver->features & CURL_VERSION_THREADSAFE_INIT) == 0) {
+  if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
     fprintf(stderr, "%s:%d Have pthread but the "
-            "CURL_VERSION_THREADSAFE_INIT feature flag is not set\n",
+            "CURL_VERSION_THREADSAFE feature flag is not set\n",
             __FILE__, __LINE__);
     return -1;
   }
@@ -92,9 +92,9 @@ int test(char *URL)
   (void)URL;
 
   ver = curl_version_info(CURLVERSION_NOW);
-  if((ver->features & CURL_VERSION_THREADSAFE_INIT) != 0) {
+  if((ver->features & CURL_VERSION_THREADSAFE) != 0) {
     fprintf(stderr, "%s:%d No pthread but the "
-            "CURL_VERSION_THREADSAFE_INIT feature flag is set\n",
+            "CURL_VERSION_THREADSAFE feature flag is set\n",
             __FILE__, __LINE__);
     return -1;
   }