This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: pthread_create -- no callback?
- From: "Robert Collins" <robert dot collins at itdomain dot com dot au>
- To: "Lassi A. Tuura" <lassi dot tuura at cern dot ch>,"Evan Pollan" <evan_pollan at yahoo dot com>
- Cc: <cygwin at cygwin dot com>
- Date: Thu, 15 Nov 2001 07:15:08 +1100
- Subject: Re: pthread_create -- no callback?
- References: <20011114141805.42346.qmail@web21009.mail.yahoo.com> <3BF28D95.69190D0D@cern.ch>
----- Original Message -----
From: "Lassi A. Tuura" <lassi.tuura@cern.ch>
To: "Evan Pollan" <evan_pollan@yahoo.com>
Cc: <cygwin@cygwin.com>
Sent: Thursday, November 15, 2001 2:28 AM
Subject: Re: pthread_create -- no callback?
> > The sample I included did check the return value of pthread_join.
>
> Nope, you are still not printing pthread_join *return* value -- print
> the int returned by pthread_join as you did with pthread_create. On
> linux it returns ESRCH = no such thread. Your problem is with the
> thread argument to pthread_join as shown below.
>
> Since you are not joining with the thread, the output might disappear.
> My guess is that the main thread finishes execution and the stdout
gets
> closed before the second thread executes, and hence you see no output
> from the other thread. That doesn't happen on linux as you can see
> below, but maybe it is reasonable behaviour on windows. If you think
it
> is a bug, I am sure cygwin authors would appreciate a patch ;-)
This is indeed the behaviour. The reason is that main() is returning as
opposed to calling pthread_exit (rv);. This is a grey area AFAIK in the
SUSv2 specification.
Patchs accepted as always, probably for gcc in this case.
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/