cURL / Mailing Lists / curl-library / Single Mail


Re: Question about synchronization and the progress callback

From: Ben Noordhuis <>
Date: Fri, 18 Mar 2011 18:34:25 +0100

On Fri, Mar 18, 2011 at 16:48, Saqib Ali <> 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
List admin:
Received on 2011-03-18