Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 11 Oct 2004 08:08:26 -0600 From: Mark Paulus Subject: Re: child thread termination causes main thread error termination In-reply-to: <7e48807e0485.7e04857e4880@tampabay.rr.com> To: "cygwin AT cygwin DOT com" Message-id: <0I5F00EETBA1DJ@pmismtp02.mcilink.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit Priority: Normal X-IsSubscribed: yes I tried compiling this, and it failed with: $ make lab4_1 gcc lab4_1.c -o lab4_1 lab4_1.c:13:32: ../inc/local_mutex.h: No such file or directory lab4_1.c:49: error: `PTHREAD_COND_INITIALIZER' undeclared here (not in a functio n) lab4_1.c:50: error: `PTHREAD_MUTEX_INITIALIZER' undeclared here (not in a functi on) lab4_1.c:52: error: `PTHREAD_COND_INITIALIZER' undeclared here (not in a functio n) lab4_1.c:53: error: `PTHREAD_MUTEX_INITIALIZER' undeclared here (not in a functi on) lab4_1.c:55: error: `PTHREAD_MUTEX_INITIALIZER' undeclared here (not in a functi on) make: *** [lab4_1] Error 1 after changing the include to be #include , it compiled fine. And it seems to run to completion, as expected.... $ ./lab4_1 waiting do_one_thing waiting do_another_thing <5 second pause> Ready to start threads ..... Starting ... do_one_thing Starting ... do_another_thing &+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-@(!( Running on a self-built cygwin 1.5.11 kernel, on WinXP / SP1. Hmmm, some more slightly interesting results. Moving this to a Debian Sarge box, and trying it gives a slightly different output: make lab4_1 cc lab4_1.c -o lab4_1 /tmp/ccbFl3T5.o(.text+0x2a0): In function `main': : undefined reference to `pthread_create' /tmp/ccbFl3T5.o(.text+0x2c3): In function `main': : undefined reference to `pthread_create' /tmp/ccbFl3T5.o(.text+0x3d2): In function `main': : undefined reference to `pthread_join' /tmp/ccbFl3T5.o(.text+0x3e5): In function `main': : undefined reference to `pthread_join' collect2: ld returned 1 exit status make: *** [lab4_1] Error 1 mgpaulus AT mpaulus:/home/mgpaulus $ make "LDFLAGS=-lpthread" lab4_1 cc -lpthread lab4_1.c -o lab4_1 mgpaulus AT mpaulus:/home/mgpaulus $ ./lab4_1 waiting do_one_thing waiting do_another_thing Ready to start threads ..... &Starting ... do_one_thing ++Starting ... do_another_thing -++++++++++----------++++++++++---------+++++++++++----------++++++++++--------- +++++++++++------------------------------+++++++++++++++++++++------------------ ------------+++++++++++++++++++++++++@(#&!(-@)#^ All threads complete !) wrap up: doing another 100, another 100, total 200 So, maybe it's not working quite as expected. If I get some time, I'll look into it some more from my side. On Sat, 09 Oct 2004 14:49:15 -0400, gmiller AT cfl DOT rr DOT com wrote: >I have a sample thread application that runs under Ferdora Core 2 latest but exits on an error condition under cygwin. If I add sleeps to the end of the child threads then the program will go to completion. While using "insight" the error can be tracked into the library code. I have attached the source code and output of cygcheck. Is this a know problem and if so is there any other workaround. -- 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/