cURL / Mailing Lists / curl-library / Single Mail


Re: How to get downloading progress using multi interface?

From: Emil Romanus <>
Date: Tue, 7 Aug 2007 18:56:23 +0200

Hi Alexander,

2007/8/7, Alexander Zubko <>:

> Is it possible to get downloaded number of bytes for every active Curl
> object in multi interface not using CURLOPT_PROGRESSFUNCTION
> callback as it is not recomended in docs?

I think it's not recommended simply because you would most likely need to
perform mutex locking and other stuff on your own. If you do this in the
right way, I do not think that using CURLOPT_PROGRESSFUNCTION while in multi
interface should be a problem. Daniel or anyone else more experienced than
me are welcome to correct this if there really *is* an issue with using
CURLOPT_PROGRESSFUNCTION while in multi interface.

I have an application with GUI main-thread and worker thread with libcurl
> multi-interface downloading
> and want to make progress bars in GUI window for every active downloading.

different for each transfer. In your progress callback function, act
according to that data, for example update different progress meters in your
application. What you specify as the CURLOPT_PROGRESSDATA for each transfer
will be the first argument in your callback function.

If you require the main GUI thread to update the progress meters itself, set
up thread locks and let the progress callback insert information into a
shared constant-sized structure which you can send pointers to through
CURLOPT_PROGRESSDATA. Then let the GUI thread loop through this information
on timed intervals and update its GUI widgets. Don't forget that shared data
between threads should *always* be locked, both on reads and writes.
Received on 2007-08-07