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 44Passing in a NULL pointer in *multi_handle* makes this function return 45CURLM_BAD_HANDLE immediately with no other action. 46 47Any use of the **multi_handle** after this function has been called and have 48returned, is illegal. 49# %PROTOCOLS% 50 51# EXAMPLE 52 53~~~c 54int main(void) 55{ 56 CURLM *multi = curl_multi_init(); 57 58 /* when the multi transfer is done ... */ 59 60 /* remove all easy handles, then: */ 61 curl_multi_cleanup(multi); 62} 63~~~ 64 65# %AVAILABILITY% 66 67# RETURN VALUE 68 69CURLMcode type, general libcurl multi interface error code. On success, 70CURLM_OK is returned. 71