1--- 2c: Copyright (C) Daniel Stenberg, <daniel.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) 12--- 13 14# NAME 15 16curl_multi_cleanup - close down a multi session 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLMcode curl_multi_cleanup(CURLM *multi_handle); 24~~~ 25 26# DESCRIPTION 27 28Cleans up and removes a whole multi stack. It does not free or touch any 29individual easy handles in any way - they still need to be closed 30individually, using the usual curl_easy_cleanup(3) way. The order of 31cleaning up should be: 32 331 - curl_multi_remove_handle(3) before any easy handles are cleaned up 34 352 - curl_easy_cleanup(3) can now be called independently since the easy 36handle is no longer connected to the multi handle 37 383 - curl_multi_cleanup(3) should be called when all easy handles are 39removed 40 41Passing in a NULL pointer in *multi_handle* makes this function return 42CURLM_BAD_HANDLE immediately with no other action. 43 44# EXAMPLE 45 46~~~c 47int main(void) 48{ 49 CURLM *multi = curl_multi_init(); 50 51 /* when the multi transfer is done ... */ 52 53 /* remove all easy handles, then: */ 54 curl_multi_cleanup(multi); 55} 56~~~ 57 58# AVAILABILITY 59 60Added in 7.9.6 61 62# RETURN VALUE 63 64CURLMcode type, general libcurl multi interface error code. On success, 65CURLM_OK is returned. 66