Subject: Re: pthread: thread switching bug?
From: Robert Collins <[email-masked]>
To: [email-masked]
Cc: Nemeth Marton <[email-masked]>
Date: 21 Oct 2001 22:01:16 +1000

On Wed, 2001-10-17 at 10:36, Christopher Faylor wrote:
> Please check out the project web page for links to available information
> and ports:  http://cygwin.com/ .
> 
> If you don't see what you need there, then the cygwin mailing list is
> the best place to make observations or get questions answered.
> Information on the mailing list is available at the project web page.
> 
> For your convenience, I've reset the Reply-To: address to point to the
> cygwin mailing list.  I've also Cc'ed this reply there.
> 
> On Wed, Oct 17, 2001 at 12:36:14AM +0200, Nemeth Marton wrote:
> >Hi!
> >
> >I have written a little program using threads. If I complie with gcc &
> >run it under Linux, it works fine.
> >
> >But when I complied with cygwin's gcc (used versions bellow), and run it
> >there was some run where not all the newline characters were on the
> >right place, like this:

This simply indicates that the printf is not atomic. The Opengroup spec
for printf does not indicate atomicity as a requirement. It's certainly
not a 'thread switching bug' - thread scheduling is handled via Win32.

It *might* be an issue in newlib, or in the cygwin console fd handler,
neither of which I've checked yet.

Can you see whether you can reproduce the behaviour when writing to a
file, not to stdout? (If you are not using fprintf now, start by trying
with fprintf (stdout,...)). Let me know via the list whether you can
make this happen with a standard file/console with fprintf and we'll
take it from there,

Rob

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