delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/15/22:19:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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: CYGWIN 1.5.9-1 - Is vprintf() not thread safe?
Date: Sun, 16 May 2004 02:19:16 +0000
Mime-Version: 1.0
Message-ID: <BAY1-F125a9hoUHAQfN00018dc6@hotmail.com>
X-OriginalArrivalTime: 16 May 2004 02:19:16.0725 (UTC) FILETIME=[301F0A50:01C43AEC]

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.

Please cc: any replies to me by e-mail as I am not subscribed to the list. 
Thank you in advance for any help that can be offered.

- 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019