[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference clt::cma

Title:DECthreads Conference
Moderator:PTHRED::MARYSTEON
Created:Mon May 14 1990
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1553
Total number of notes:9541

1504.0. "pthread detach" by DUCAT::ROSCOE () Tue Mar 11 1997 22:59

I've got a quick question about pthread_detach.  I noticed in the debugger 
that when pthread_detach completes it zeroes out the thread id that was
passed into it.  The documentation suggests that the input to the call is read
only.  Is this expected behaviour?  I've seen this happen on Digital unix 3.2G
and AlphaVMS V6.2.  The posix 1003.4a (draft 4) interface is being used.

thanks
Rich
T.RTitleUserPersonal
Name
DateLines
1504.1DCETHD::BUTENHOFDave Butenhof, DECthreadsWed Mar 12 1997 11:189
Yes, it is expected (and intentional) behavior. The standard was specifically
written to allow it. The idea is that the handle can no longer be used, and
should be cleared to make later validation easier.

(Note that POSIX threads pthread_detach(), and pthread_join() -- which also
detaches the target thread -- take the pthread_t by value rather than by
reference, and cannot clear the handle.)

	/dave
1504.2For those of you reading lightly.WTFN::SCALESDespair is appropriate and inevitable.Wed Mar 12 1997 15:118
.1> Note that POSIX threads pthread_detach(), and pthread_join()

In case it's not perfectly clear to the rest of you, Dave is using "POSIX" here
to refer to the (now standard) .1c pthread interface; whereas, Rich is using the
old .4a draft interface.


				Webb