From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 704 invoked by alias); 14 Nov 2001 15:28:27 -0000 Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@sources.redhat.com Received: (qmail 669 invoked from network); 14 Nov 2001 15:28:25 -0000 Received: from unknown (HELO smtp3.cern.ch) (137.138.131.164) by sourceware.cygnus.com with SMTP; 14 Nov 2001 15:28:25 -0000 Received: from pb-d-137-138-206-44.cern.ch (IDENT:root@pb-d-137-138-206-44.cern.ch [137.138.206.44]) by smtp3.cern.ch (8.11.6/8.11.6) with ESMTP id fAEFSNo15856; Wed, 14 Nov 2001 16:28:23 +0100 (MET) Received: from cern.ch (IDENT:lat@localhost.cern.ch [127.0.0.1]) by pb-d-137-138-206-44.cern.ch (8.9.3/8.9.3) with ESMTP id QAA03341; Wed, 14 Nov 2001 16:28:21 +0100 Message-ID: <3BF28D95.69190D0D@cern.ch> Date: Sun, 11 Nov 2001 08:26:00 -0000 From: "Lassi A. Tuura" Organization: Northeastern University, Boston, USA X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Evan Pollan CC: cygwin@cygwin.com Subject: Re: pthread_create -- no callback? References: <20011114141805.42346.qmail@web21009.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg00188.txt.bz2 > 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 ;-) 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/