curl / Mailing Lists / curl-library / Single Mail

curl-library

Question about curl_multi_remove_handle()

From: Andreas Hollaus <andreas.hollaus_at_ericsson.com>
Date: Tue, 29 Nov 2016 15:44:07 +0100

Hi,

I've read that calling curl_multi_remove_handle() is the correct way to
stop an ongoing transfer. Still, I'm curious about the callback
functions configured for the easy handle (CURLOPT_HEADERFUNCTION &
CURLOPT_WRITEFUNCTION).

Can they still be triggered after the handle was removed, in the rare
case that some data was previously fetched to the buffer? I do
understand that no more data will be fetched to the buffer after the
handle is removed.

I guess that the callback functions are triggered by the
curl_multi_perform() call, right? What if there's a task switch before
the callback function is triggered so that another thread could call
curl_multi_remove_handle(). Would that still stop the waiting callback
function from being called?

I ask this question to make sure that user data pointer supplied to the
callback function will never be used after I've called
curl_multi_remove_handle(), as the data pointed to by the user data
pointer will be freed after the handle is removed.

BTW: I'm using libcurl 7.44.0.

Regards
Andreas

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-29