cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to resume a paused download.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 8 Sep 2013 23:44:00 +0200 (CEST)

On Sun, 8 Sep 2013, Md Kashif wrote:

> I think I did not explain myself clearly. What I've done is that for
> download I initiate a separate thread. The easyhandle is global. The dialog
> on which pause button is present is on the main thread. When user clicks
> pause I call curl_easy_pause() to pause the download. When user clicks
> Resume then I unpause using curl_easy_pause(). However the documentation of
> curl_easy_pause() clearly says that it must be called from the same thread
> where download is happening. 

Correct, as otherwise you risk running into a race condition of some sorts.

> 2) Now other option for me is CURL_WRITEFUNC_PAUSE but if I use it then how
> do I unpause?

With curl_easy_pause() from example the progress callback. The
curl_easy_pause() man page is now updated to suggest exactly this!

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-09-08