delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/10/31/21:36:47

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Wed, 31 Oct 2001 21:37:18 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: pthread: thread switching bug?
Message-ID: <20011031213718.A30079@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <EA18B9FA0FE4194AA2B4CDB91F73C0EF08F24F AT itdomain002 DOT itdomain DOT net DOT au>
Mime-Version: 1.0
In-Reply-To: <EA18B9FA0FE4194AA2B4CDB91F73C0EF08F24F@itdomain002.itdomain.net.au>
User-Agent: Mutt/1.3.21i

On Thu, Nov 01, 2001 at 01:38:03PM +1100, Robert Collins wrote:
>> -----Original Message-----
>> From: Christopher Faylor [mailto:cgf AT redhat DOT com]
>> >Thanks for the testing, you've shown that there is non 
>> thread safe code,
>> >probably in the fhandler_consoler in cygwin, or possibly in the MS
>> >Windows console code. Right now we don't know which.
>> 
>> I'm still not sure why this is a cygwin bug.  Is there some 
>> requirement
>> that writes to the console be atomic?  Your (Robert's) original email
>> indicated that the Opengroup spec didn't have this as a requirement.
>
>It's non expected behaviour at the least. At worst it could be a symptom
>of something more serious that is faulty. I intend to analyse it at some
>point. 
>
>The Opengroup spec for printf doesn't document any thead safety needs,
>but, one would expect fprintf to a file to be atomic regardless of the
>actual file... There are separate thread considerations elsewhere in
>that tome, but I don't have time to dig them up right now.

I wouldn't be surprised to find that the "thread safety" of file writes
is actually due to the fact that file writes are *much* faster than
writes to the console.  Since cygwin processes every character that goes
to the console it isn't surprising to me that threads will interleave
their output.  There is certainly no console locking going on.

It's possible that CYGWIN=tty would also have a different behavior.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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