Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com> List-Archive: <http://sourceware.org/ml/cygwin/> List-Post: <mailto:cygwin AT cygwin DOT com> List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Originating-IP: [65.25.165.241] X-Originating-Email: [jw2357 AT hotmail DOT com] X-Sender: jw2357 AT hotmail DOT com From: "John William" <jw2357 AT hotmail DOT com> To: cygwin AT cygwin DOT com Subject: Re: CYGWIN 1.5.9-1 - Is vprintf() not thread safe? Date: Fri, 21 May 2004 05:08:24 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: <BAY1-F130BL7jkE8y3500024d13@hotmail.com> X-OriginalArrivalTime: 21 May 2004 05:08:25.0081 (UTC) FILETIME=[A5140690:01C43EF1] >From: Brian Ford <ford AT vss DOT fsi DOT com> >To: John William <jw2357 AT hotmail DOT 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/