CYGWIN 1.5.9-1 - Is vprintf() not thread safe?

John William jw2357@hotmail.com
Fri May 21 09:56:00 GMT 2004


>From: Brian Ford <ford@vss.fsi.com>
>To: John William <jw2357@hotmail.com>
>Subject: Re: CYGWIN 1.5.9-1 - Is vprintf() not thread safe?
>
>On Sun, 16 May 2004, John William wrote:
>
> > I'm having problems with a program that uses vprintf() to show error
> > messages. The program works fine when run as a single-threaded program. 
>When
<snip>
> > From reading the GNU docs, I had the impression that functions such as
> > vprintf() were supposed to be thread safe. I have noticed that printf() 
>also
> > appears to not be thread-safe, but I haven't methodically checked all 
>the
> > related functions.
>
>Um..., Cygwin uses newlib for its C library, so what GNU docs were you
>reading?

I was looking at the GNU docs to see if I missed something and vprintf() was 
not "supposed" to be thread-safe. From my reading of the GNU docs, only as a 
reference to how vprintf() "should" work, it seems that printf(), vprintf() 
and the associated functions should be atomic with respect to console 
output. Meaning that I should expect that the output of a vprintf() cannot 
be interrupted by another stdio stream output function (like another 
vprintf()).

Certainly the crashes aren't expected either.

>IIRC, several thread safe stdio issues have been fixed recently, both in
>Cygwin and in newlib.  Please try a recent Cygwin DLL snapshot:
>
>http://cygwin.com/snapshots/
>
>and report back.  Thanks.

I tried the cygwin.dll snapshot dated 2004-05-20 and it still outputs 
interleaved text with multiple threads and vprintf()/vsprintf() crash when 
called from multiple threads and not protected with mutex_lock() and 
mutex_unlock() calls around them. This is on a dual-processor system, BTW.

- John

_________________________________________________________________
Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! 
http://join.msn.click-url.com/go/onm00200362ave/direct/01/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list