This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: problem with pthread.h - child thread's ending locks up main thread
- From: "Dave Korn" <dk at artimi dot com>
- To: <cygwin at cygwin dot com>
- Date: Thu, 21 Oct 2004 13:57:29 +0100
- Subject: RE: problem with pthread.h - child thread's ending locks up main thread
> -----Original Message-----
> From: cygwin-owner On Behalf Of Ben Lavender
> Sent: 21 October 2004 12:06
> Hello all, I have a problem. I have a bug or misconfig that manifests
> itself in pthreads.h.
>
> Basically, if a child thread ends, the main thread stops executing.
> The program does not
> end, but it doesn't go any further.
Your example runs fine on my system: main keeps going after threadfunc
terminates.
dk@mace /test/pthread/ch-term2> ./foo.exe
looping in main
looping in thread func at 1
looping in main
looping in thread func at 2
looping in main
looping in thread func at 3
looping in main
looping in thread func at 4
looping in main
looping in main
looping in main
looping in main
looping in main
looping in main
looping in main
<Ctrl-C'd it here>
However it should be pointed out that I'm running a custom build of the
cygwin dll from recent CVS:
Cygwin DLL version info:
DLL version: 1.5.12
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 116
Shared data: 4
DLL identifier: cygwin1
Mount registry: 2
Cygnus registry name: Cygnus Solutions
Cygwin registry name: Cygwin
Program options name: Program Options
Cygwin mount registry name: mounts v2
Cygdrive flags: cygdrive flags
Cygdrive prefix: cygdrive prefix
Cygdrive default prefix:
Build date: Wed Oct 13 13:25:07 GMTST 2004
Shared id: cygwin1S4
So perhaps you'll have better luck if you try using the latest snapshot.
In general, your usage of the pthread functions looks correct to me.
(However, if you ever post a sample that declares main to return void in
comp.lang.c, they'll tear your throat out with their bare teeth!) You
should fix the warnings by defining the functions to have the correct
prototypes as a matter of good style (it's bad to have code that builds with
lots of warnings, because you get used to ignoring or skipping over them in
the build output, and then you miss _real_ problems when they arise, even
though the compiler spotted them for you), but I don't think there's
anything in your code that would be causing this problem.
cheers,
DaveK
--
Can't think of a witty .sigline today....
--
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/