[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

1543.0. "PThread resource cleanup." by PEACHS::MAXIE (Michael Maxie, UNIX Applications Support, 343-0120) Mon May 12 1997 13:51

Excuse me for asking a question that is prbably in the
standard, but I don't have access to the standard.

What does the standard say about releasing resources
from a joinable thread that doesn't explicitly call
pthread_exit and no pthread_join is called?  Does a
thread hold on to its resources until it delivers its
exit status?

BTW when I say resources I mean the stack.

Thanks,
T.RTitleUserPersonal
Name
DateLines
1543.1PEACHS::MAXIEMichael Maxie, UNIX Applications Support, 343-0120Mon May 12 1997 17:368
From further research it appears that pthread_detach
or pthread_join must be called to free the resources
upon termination of the joinable thread.  So, if a 
joinable thread is not joined it resources will stay
tied up until it is joined or the process dies.

Is this a correct interpretation?  What does the
standard say?
1543.2The standard says nothing; see the DECthreads documentation!WTFN::SCALESDespair is appropriate and inevitable.Mon May 12 1997 18:1729
.0> What does the standard say about releasing resources
.0> from a joinable thread that doesn't explicitly call
.0> pthread_exit and no pthread_join is called?

Virtually nothing.

.0> BTW when I say resources I mean the stack.

OK, absolutely nothing.

The standard says that the exit value from the terminated thread is made
available to the joining thread; it leaves all the details of how that is
accomplished up to the implementation provider.

.1> if a joinable thread is not joined it resources will stay tied up until it 
.1> is joined or the process dies.

After a thread terminates, many of its resources are freed, over time, whenever
possible, depending on which version of which operating system you are using. 
However, if the thread is never joined with, and if it is never explicitly
detached, and if it was not created with the detached attribute, then some
amount of resources (memory) will be left tied up.

Why do you ask?  (It seems like the DECthreads documentation, as well as
numerous notes in this conference, is pretty clear on this score...so what are
you trying to get at?)


					Webb
1543.3DCETHD::BUTENHOFDave Butenhof, DECthreadsMon May 19 1997 12:3713
The standard says that, in order to release resources, you must JOIN or
DETACH a thread.

The standard does not REQUIRE that an implementation retain all resources
until JOIN or DETACH, however, and DECthreads does already release some
resources, as possible, once the thread has terminated. This may vary from
release to release as implementation needs vary, and we do not document or
support any such interpretation.

The standard says that, in order to release resources, you must JOIN or
DETACH a thread.

	/dave