View Issue Details

IDProjectCategoryView StatusLast Update
00011671003.1(2016/18)/Issue7+TC2System Interfacespublic2024-06-11 09:09
ReporterFlorian Weimer Assigned To 
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NameFlorian Weimer
OrganizationRed Hat
User Referencehttps://sourceware.org/bugzilla/show_bug.cgi?id=22337
Sectionpthread_detach
Page Numberunknown
Line Numberunknown
Interp Status---
Final Accepted Text0001167:0004238
Summary0001167: Does pthread_detach make a thread non-joinable?
DescriptionThe description of pthread_detach is carefully worded in such a way that it does not mention whether the thread ceases to be joinable/is in a detached state after the call to the function. It is unclear what the intent is. Based on a strict reading of specification, the only way to create a non-joinable thread is the detachstate thread attribute specified at thread creation.

There are two choices here: Mention that pthread_detach makes the thread non-joinable, or explicitly say that pthread_detach does not alter the joinable state of the thread (so that pthread_join is permitted if the lifetime of the thread has not ended yet).
Desired ActionThe GNU C Library favors that pthread_detach makes the thread non-joinable because this is what the current implementation does.
Tagstc3-2008

Activities

philip-guenther

2017-10-30 16:40

reporter   bugnote:0003875

Hmm, XSH 2.9.2 "Thread IDs" ends with this sentence:
    If a thread is detached, its thread ID is invalid for use as an
    argument in a call to pthread_detach()or pthread_join().

Does that cover this?

Florian Weimer

2017-10-30 16:47

reporter   bugnote:0003876

It is unclear if XSH 2.9.2 “detached” here refers to the detachstate, or the action of pthread_detach.

The behavior of pthread_detach is specified as:

“The pthread_detach() function shall indicate to the implementation that storage for the thread thread can be reclaimed when that thread terminates.”

So it is specifically not phrased in terms of detached/joinable threads.

geoffclare

2019-01-31 17:28

manager   bugnote:0004238

On page 1636 line 53334 section pthread_detach(), change:
The pthread_detach() function shall indicate to the implementation that storage for the thread thread can be reclaimed when that thread terminates.
to:
The pthread_detach() function shall change the thread thread from joinable to detached, indicating to the implementation that storage for the thread can be reclaimed when the thread terminates.

Issue History

Date Modified Username Field Change
2017-10-30 16:33 Florian Weimer New Issue
2017-10-30 16:33 Florian Weimer Name => Florian Weimer
2017-10-30 16:33 Florian Weimer Organization => Red Hat
2017-10-30 16:33 Florian Weimer User Reference => https://sourceware.org/bugzilla/show_bug.cgi?id=22337
2017-10-30 16:33 Florian Weimer Section => pthread_detach
2017-10-30 16:33 Florian Weimer Page Number => unknown
2017-10-30 16:33 Florian Weimer Line Number => unknown
2017-10-30 16:40 philip-guenther Note Added: 0003875
2017-10-30 16:47 Florian Weimer Note Added: 0003876
2019-01-31 17:28 geoffclare Note Added: 0004238
2019-01-31 17:29 geoffclare Interp Status => ---
2019-01-31 17:29 geoffclare Final Accepted Text => 0001167:0004238
2019-01-31 17:29 geoffclare Status New => Resolved
2019-01-31 17:29 geoffclare Resolution Open => Accepted As Marked
2019-01-31 17:29 geoffclare Tag Attached: tc3-2008
2019-11-08 10:28 geoffclare Status Resolved => Applied
2024-06-11 09:09 agadmin Status Applied => Closed