This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: printf output missing in multi-threaded program


On Sep 24 09:20, Siegmar Gross wrote:
> Hi,
> 
> some of my multi-threaded programs don't print everything they should.
> I have for example a small program to show that LinuxThreads don't
> behave like real POSIX threads concerning "fork()" (only the thread
> which creates a child process can wait for its termination with
> LinuxThreads). When I run the program on Solaris I get the following
> output:
> 
> gorbag work 23 fork_thr                          !!!! Solaris
> Thread thr_fork: forking a child process.
> Child process: I'm sleeping for 2 seconds.
> Thread thr_wait: sleeping for 5 seconds.
> Thread thr_fork: sleeping for 10 seconds.
> Child process: terminating.
> Thread thr_wait: try to wait for child process.
> Thread thr_wait: child terminated.
> Thread thr_fork: try to wait for my child.       !!!!!! missing in Cygwin
> Thread thr_fork: No child processes              !!!!!! missing in Cygwin
> gorbag work 24 
> 
> 
> When I compile and run the program on Cygwin the last output from
> "thr_fork" will not be displayed. I've upgraded Cygwin to the latest
> version yesterday. "cygcheck -c" displays that all packages are OK. Cygwin
> is installed on Windows XP with all updates excluding SP2.
> 
> eiger src 4 fork_thr
> Thread thr_fork: forking a child process.        !!!! Cygwin
> Thread thr_wait: sleeping for 5 seconds.
> Thread thr_fork: sleeping for 10 seconds.
> Child process: I'm sleeping for 2 seconds.
> Child process: terminating.
> Thread thr_wait: try to wait for child process.
> Thread thr_wait: child terminated.
> eiger src 5 

That's what I get with a recent Cygwin snapshot:

Thread thr_fork: forking a child process.
Thread thr_wait: sleeping for 5 seconds.
Thread thr_fork: sleeping for 10 seconds.
Child process: I'm sleeping for 2 seconds.
Thread thr_fork: 1 s of sleeping time passed
Thread thr_fork: 2 s of sleeping time passed
Child process: terminating.
Thread thr_fork: 3 s of sleeping time passed
Thread thr_fork: 4 s of sleeping time passed
Thread thr_wait: try to wait for child process.
Thread thr_wait: child terminated.
Thread thr_fork: 5 s of sleeping time passed
Thread thr_fork: 6 s of sleeping time passed
Thread thr_fork: 7 s of sleeping time passed
Thread thr_fork: 8 s of sleeping time passed
Thread thr_fork: 9 s of sleeping time passed
Thread thr_fork: 10 s of sleeping time passed
Thread thr_fork: try to wait for my child.
Thread thr_fork: No child processes

Looks ok, doesn't it?

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]