delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/14/10:38:22

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
X-Originating-IP: [198.142.164.226]
From: "Gareth Pearce" <tilps AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
References: <20011114141805 DOT 42346 DOT qmail AT web21009 DOT mail DOT yahoo DOT com> <3BF28D95 DOT 69190D0D AT cern DOT ch>
Subject: Re: pthread_create -- no callback?
Date: Thu, 15 Nov 2001 02:38:00 +1100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <OE539x6HHGNZ4mF1IT100011214@hotmail.com>
X-OriginalArrivalTime: 14 Nov 2001 15:38:01.0722 (UTC) FILETIME=[5815BDA0:01C16D22]

----- Original Message -----
From: "Lassi A. Tuura" <lassi DOT tuura AT cern DOT ch>
To: "Evan Pollan" <evan_pollan AT yahoo DOT com>
Cc: <cygwin AT cygwin DOT 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 ;-)
no such thread implies that the thread has already completed execution,
doesnt it?, so therefore the problem would have to be something along the
lines of threads not having their buffers flushed before exiting? - just a
guess
however under cygwin ... if you replace the print statement with a variable
incriment - it doesnt take place either... wish I knew why ... debugging mt
apps is not my idea of fun though ... so I am not about to discover whats
wrong so I can patch it...

*vague though that the thread might not be fully created when pthread_create
returns or something...*

hmm i should sleep instead of posting - probably will look silly in the
morning...
>
> Your code:
> >     void* threadExitStatus;
> >     cout << "--> pthread_join()\n";
> >     pthread_join(&thread, &threadExitStatus);
> >     cout << "<-- pthread_join():" << (int)threadExitStatus << "\n";
>
> Change this to:
>       retVal = pthread_join(&thread, &threadExitStatus);
>       cout << "<-- pthread_join():" << retVal
>            << " " << (int)threadExitStatus << "\n";
>
> I would have expected you to see this in your compilation:
> /tmp/foo.cxx:24: warning: passing `pthread_t *' to argument 1 of
>     `pthread_join(long unsigned int, void **)' lacks a cast
>
> Output with my changes (on linux):
> $ ./a.out
> --> pthread_create()
> <-- pthread_create():0
> --> pthread_join()
> <-- pthread_join():3 1075347592
> --> callbackFunction(0x8048b9b)
> $ grep ESRCH /usr/include/asm/errno.h
> #define ESRCH            3      /* No such process */
>
> HTH,
> //lat
> --
> Those who cannot remember the past are condemned to repeat it.
> --George Santayana
>
> --
> 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/
>
>

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