cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi_threads

From: Jamie Lokier <jamie_at_shareable.org>
Date: Tue, 6 Dec 2005 11:57:24 +0000

Dan Fandrich wrote:
> On Mon, Dec 05, 2005 at 11:27:19PM +0100, Daniel Stenberg wrote:
> > On Mon, 5 Dec 2005, Yi Li wrote:
> >
> > >The program fault. Does anybody know why?
> > ...
> > Buffer overflow when 'i' reaches 4.
>
> Plus, fwrite isn't protected from simultaneous usage by more than one thread
> in curl's default output callback.

If multiple threads are writing to the same file, that could mix up
the writing, but it shouldn't fault. Every FILE * has a lock which is
taken by functions like 'fwrite'. Hence 'fwrite_unlocked' etc.

-- Jamie
Received on 2005-12-06