quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLSHOPT_USERDATA.md (1191B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLSHOPT_USERDATA
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLSHOPT_LOCKFUNC (3)
      9   - curl_share_cleanup (3)
     10   - curl_share_init (3)
     11   - curl_share_setopt (3)
     12 Protocol:
     13   - All
     14 Added-in: 7.10.3
     15 ---
     16 
     17 # NAME
     18 
     19 CURLSHOPT_USERDATA - pointer passed to the lock and unlock mutex callbacks
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_USERDATA, void *clientp);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 The *clientp* parameter is held verbatim by libcurl and is passed on as
     32 the *clientp* argument to the callbacks set with
     33 CURLSHOPT_LOCKFUNC(3) and CURLSHOPT_UNLOCKFUNC(3).
     34 
     35 # %PROTOCOLS%
     36 
     37 # EXAMPLE
     38 
     39 ~~~c
     40 struct secrets {
     41   void *custom;
     42 };
     43 
     44 int main(void)
     45 {
     46   CURLSHcode sh;
     47   struct secrets private_stuff;
     48   CURLSH *share = curl_share_init();
     49   sh = curl_share_setopt(share, CURLSHOPT_USERDATA, &private_stuff);
     50   if(sh)
     51     printf("Error: %s\n", curl_share_strerror(sh));
     52 }
     53 ~~~
     54 
     55 # %AVAILABILITY%
     56 
     57 # RETURN VALUE
     58 
     59 CURLSHE_OK (zero) means that the option was set properly, non-zero means an
     60 error occurred. See libcurl-errors(3) for the full list with
     61 descriptions.