Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 17 May 2004 10:48:42 -0500 From: Brian Ford Reply-To: cygwin AT cygwin DOT com To: John William cc: cygwin AT cygwin DOT com Subject: Re: CYGWIN 1.5.9-1 - Is vprintf() not thread safe? In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes 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 > compiled as a multi-threaded program, the console output of vprintf() is > "interleaved" with output from the various threads mixed together. With a > large number of threads, the program often drops core. > > Adding a pthread_mutex_lock() and ..._unlock() pair around the vprintf() > makes it work correctly and it no longer drops core. > > 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? 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. -- Brian Ford Senior Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International the best safety device in any aircraft is a well-trained pilot... -- 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/