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: child thread termination causes main thread error termination


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 <pthread.h>, 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@mpaulus:/home/mgpaulus
$ make "LDFLAGS=-lpthread" lab4_1
cc   -lpthread  lab4_1.c   -o lab4_1
mgpaulus@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@cfl.rr.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/


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