Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Date: Fri, 18 May 2001 23:04:43 -0400 From: Christopher Faylor To: cygwin-developers AT cygwin DOT com Subject: Re: pthread gotchas Message-ID: <20010518230443.A26250@redhat.com> Reply-To: cygwin-developers AT cygwin DOT com Mail-Followup-To: cygwin-developers AT cygwin DOT com References: <20010518221107 DOT A12195 AT redhat DOT com> <021a01c0e00b$e8d48dc0$0200a8c0 AT lifelesswks> <20010518224535 DOT A26035 AT redhat DOT com> <023001c0e00e$9e96c9a0$0200a8c0 AT lifelesswks> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.11i In-Reply-To: <023001c0e00e$9e96c9a0$0200a8c0@lifelesswks>; from robert.collins@itdomain.com.au on Sat, May 19, 2001 at 12:51:34PM +1000 On Sat, May 19, 2001 at 12:51:34PM +1000, Robert Collins wrote: >----- Original Message ----- >From: "Christopher Faylor" >To: >Sent: Saturday, May 19, 2001 12:45 PM >Subject: Re: pthread gotchas > >> On Sat, May 19, 2001 at 12:32:10PM +1000, Robert Collins wrote: >> >>work with pthreads. I ran the program on linux. >> ^^^^^^^^^^^^^^^^^^^^^^^^^^ > >I'm just guessing here, but you would like me to actually read what you >write? I guess that mental telepathy isn't as good as we thought :] :-) I've been misreading so much email lately that it is very hard for me to cast any stones. >> This email was talking about linux. I ran the program on linux first so >> that I could get a feel for how it was supposed to work and was >> surprised to find that linux broke my perceptions. > >openBSD test results: > >in subproc, sleeping >in parent, starting thread, pid 12819in tf, waiting for 12819 >0 = pthread_create >in subproc, exiting >12819 = waitpid >waitpid: Undefined error: 0 >returning >0 = pthread_join >exiting Phew. This is what I was expecting. >> I have included my test program below. The waitpid, which is invoked >in >> the secondary thread fails unless I move the fork into the same >thread. > >I haven't looked into why yet. > >> #include >> #include >> #include > >btw: wait.h should be sys/wait according to the SUS. You're right. I changed this but there was not difference in behavior, of course. cgf