curl-library
Re: Question about synchronization and the progress callback
Date: Fri, 18 Mar 2011 18:34:25 +0100
On Fri, Mar 18, 2011 at 16:48, Saqib Ali <saqib.ali.75_at_gmail.com> wrote:
> I would like to serialize calls to the progress callback in this way. The
> action I'm taking in the function takes a significant amount of time. So I'm
> seeing overlapping calls to the progress function. To deal with this, I've
> inserted a mutex
> What I'm seeing is that the mutex lock seems to get ignored. My
> assumption/understanding of the cURL multi-stack was that each easy-handle
> has its own thread which calls the progress function. Threads within the
> same process should respect mutex locks. Is there a gap in my understanding?
libcurl doesn't use threads at all. If your application isn't
multi-threaded either, you can't get overlapping calls.
As to the mutex being ignored: if it's created with
PTHREAD_MUTEX_RECURSIVE then it can be locked multiple times by the
same thread. Doing that with other mutex types leads to undefined
behaviour.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-18