Date: Mon, 25 Aug 1997 04:20:22 +0200 (CEST) From: Mikael Karpberg <karpen@ocean.campus.luth.se> To: bradley@dunn.org Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: pthread_join question Message-ID: <199708250220.EAA25202@ocean.campus.luth.se> In-Reply-To: <Pine.BSF.3.96.970824041223.838A-100000@ns2.harborcom.net> from Bradley Dunn at "Aug 24, 97 04:31:15 am"
next in thread | previous in thread | raw e-mail | index | archive | help
According to Bradley Dunn: > Hi, > > I just bought _Programming with POSIX Threads_ by Butenhof so I could > learn a little bit about threads. I have a question about pthread_join in > FreeBSD. It seems from looking at the source in > src/lib/libc_r/uthread/uthread_join.c > and from trying the test code on page 32 in the book that pthread_join > will always return -1 if an error occurs. The book says that Pthreads > doesn't use errno and returns the error directly. Can someone help me > understand this better? [...] > If I modify the code so that it checks errno, I find that errno is > indeed ESRCH (and the source for pthread_join seems to indicate this is > normal behavior). >From the only reference I have available (Solaris man page): RETURN VALUES If successful, both pthread_join() and thr_join() would return 0; otherwise, an error number is returned to indicate the error. Seems like you're right. Then I guess libc_r has a bug. :-) Try doing a send-pr with the problem. Maybe check the cvs online for the last few commits, and mail the person that seem to be most responsible for libc_r and tell him you have done a send-pr, too. :-) > Oh, and another quick question. I compiled the program using: > cc -Wall -othread_error thread_error.c -lc_r > Is the '-lc_r' the correct way to get the thread functions linked in? I really have no idea, but since no one else seem to have answered.. I think I saw a commit adding -thread or -threads option... Try: cc -Wall -threads -othread_error thread_error.c or cc -Wall -thread -othread_error thread_error.c And see if it works :-) > PS -- Please CC me as I am not on -hackers. Done. /Mikael
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708250220.EAA25202>