quickjs-tart

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

CURLSHOPT_UNLOCKFUNC.md (1662B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLSHOPT_UNLOCKFUNC
      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_UNLOCKFUNC - mutex unlock callback
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 void unlockcb(CURL *handle, curl_lock_data data, void *clientp);
     27 
     28 CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNLOCKFUNC, unlockcb);
     29 ~~~
     30 
     31 # DESCRIPTION
     32 
     33 Set a mutex unlock callback for the share object. There is a corresponding
     34 CURLSHOPT_LOCKFUNC(3) callback called when the mutex is first locked.
     35 
     36 The *unlockcb* argument must be a pointer to a function matching the
     37 prototype shown above. The arguments to the callback are:
     38 
     39 *handle* is the currently active easy handle in use when the share object
     40 is released.
     41 
     42 The *data* argument tells what kind of data libcurl wants to unlock. Make
     43 sure that the callback uses a different lock for each kind of data.
     44 
     45 *clientp* is the private pointer you set with CURLSHOPT_USERDATA(3).
     46 This pointer is not used by libcurl itself.
     47 
     48 # %PROTOCOLS%
     49 
     50 # EXAMPLE
     51 
     52 ~~~c
     53 extern void mutex_unlock(CURL *, curl_lock_data, void *);
     54 
     55 int main(void)
     56 {
     57   CURLSHcode sh;
     58   CURLSH *share = curl_share_init();
     59   sh = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, mutex_unlock);
     60   if(sh)
     61     printf("Error: %s\n", curl_share_strerror(sh));
     62 }
     63 ~~~
     64 
     65 # %AVAILABILITY%
     66 
     67 # RETURN VALUE
     68 
     69 CURLSHE_OK (zero) means that the option was set properly, non-zero means an
     70 error occurred. See libcurl-errors(3) for the full list with
     71 descriptions.