Is there an easy way to cancel a curl_easy_perform from another thread?
+5
A:
You have to use the callback functions (write/read/progress) to perform the cancel. The other thread needs to set a flag and the callback function checks the flag and returns the proper value to cancel the operation.
robottobor
2008-10-25 02:06:52
A:
Im using progress callback atm. So if i return !0 in that it will cancel it?
Edit: Works a treat. Thanks!
Lodle
2008-10-25 03:01:47
A:
The above strategy fails in some conditions. On some FTP sites I experience a 60 second delay before the transfer begins. During this time no callbacks are invoked, if my users try to cancel the transfer they get hung on the pthread_join until the transfer starts and the first callback runs.
Is my only options to do a pthread_cancel? Is there any other way to get curl_easy_perform to return?
JLuna
2009-11-11 16:33:21