1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_multi_cleanup 5Section: 3 6Source: libcurl 7See-also: 8 - curl_easy_cleanup (3) 9 - curl_easy_init (3) 10 - curl_multi_get_handles (3) 11 - curl_multi_init (3) 12Protocol: 13 - All 14Added-in: 7.9.6 15--- 16 17# NAME 18 19curl_multi_cleanup - close down a multi session 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLMcode curl_multi_cleanup(CURLM *multi_handle); 27~~~ 28 29# DESCRIPTION 30 31This function is the opposite of curl_multi_init(3). Cleans up and removes a 32whole multi stack. It does not free or touch any individual easy handles in 33any way - they still need to be closed individually, using the usual 34curl_easy_cleanup(3) way. The order of cleaning up should be: 35 361 - curl_multi_remove_handle(3) before any easy handles are cleaned up 37 382 - curl_easy_cleanup(3) can now be called independently since the easy 39handle is no longer connected to the multi handle 40 413 - curl_multi_cleanup(3) should be called when all easy handles are 42removed 43 44When this function is called, remaining entries in the connection pool held by 45the multi handle are shut down, which might trigger calls to the 46CURLMOPT_SOCKETFUNCTION(3) callback. 47 48Passing in a NULL pointer in *multi_handle* makes this function return 49CURLM_BAD_HANDLE immediately with no other action. 50 51Any use of the **multi_handle** after this function has been called and have 52returned, is illegal. 53# %PROTOCOLS% 54 55# EXAMPLE 56 57~~~c 58int main(void) 59{ 60 CURLM *multi = curl_multi_init(); 61 62 /* when the multi transfer is done ... */ 63 64 /* remove all easy handles, then: */ 65 curl_multi_cleanup(multi); 66} 67~~~ 68 69# %AVAILABILITY% 70 71# RETURN VALUE 72 73CURLMcode type, general libcurl multi interface error code. On success, 74CURLM_OK is returned. 75