xref: /freebsd/share/man/man3/pthread_detach.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1bb8a4204SJohn Birrell.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
20f7d6847SJulian Elischer.\" All rights reserved.
30f7d6847SJulian Elischer.\"
40f7d6847SJulian Elischer.\" Redistribution and use in source and binary forms, with or without
50f7d6847SJulian Elischer.\" modification, are permitted provided that the following conditions
60f7d6847SJulian Elischer.\" are met:
70f7d6847SJulian Elischer.\" 1. Redistributions of source code must retain the above copyright
80f7d6847SJulian Elischer.\"    notice, this list of conditions and the following disclaimer.
90f7d6847SJulian Elischer.\" 2. Redistributions in binary form must reproduce the above copyright
100f7d6847SJulian Elischer.\"    notice, this list of conditions and the following disclaimer in the
110f7d6847SJulian Elischer.\"    documentation and/or other materials provided with the distribution.
120f7d6847SJulian Elischer.\" 3. All advertising materials mentioning features or use of this software
130f7d6847SJulian Elischer.\"    must display the following acknowledgement:
140f7d6847SJulian Elischer.\"	This product includes software developed by John Birrell.
150f7d6847SJulian Elischer.\" 4. Neither the name of the author nor the names of any co-contributors
160f7d6847SJulian Elischer.\"    may be used to endorse or promote products derived from this software
170f7d6847SJulian Elischer.\"    without specific prior written permission.
180f7d6847SJulian Elischer.\"
190f7d6847SJulian Elischer.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
200f7d6847SJulian Elischer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
210f7d6847SJulian Elischer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
220f7d6847SJulian Elischer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
230f7d6847SJulian Elischer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
240f7d6847SJulian Elischer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
250f7d6847SJulian Elischer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
260f7d6847SJulian Elischer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
270f7d6847SJulian Elischer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
280f7d6847SJulian Elischer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
290f7d6847SJulian Elischer.\" SUCH DAMAGE.
300f7d6847SJulian Elischer.\"
310f7d6847SJulian Elischer.Dd April 4, 1996
320f7d6847SJulian Elischer.Dt PTHREAD_DETACH 3
33a307d598SRuslan Ermilov.Os
340f7d6847SJulian Elischer.Sh NAME
350f7d6847SJulian Elischer.Nm pthread_detach
360f7d6847SJulian Elischer.Nd detach a thread
37d8a78688SAlexey Zelkin.Sh LIBRARY
38ec7452f1SRuslan Ermilov.Lb libpthread
390f7d6847SJulian Elischer.Sh SYNOPSIS
4032eef9aeSRuslan Ermilov.In pthread.h
410f7d6847SJulian Elischer.Ft int
420f7d6847SJulian Elischer.Fn pthread_detach "pthread_t thread"
430f7d6847SJulian Elischer.Sh DESCRIPTION
440f7d6847SJulian ElischerThe
450f7d6847SJulian Elischer.Fn pthread_detach
460f7d6847SJulian Elischerfunction is used to indicate to the implementation that storage for the
470f7d6847SJulian Elischerthread
480f7d6847SJulian Elischer.Fa thread
49c6ff3a1bSSheldon Hearncan be reclaimed when the thread terminates.
50c6ff3a1bSSheldon HearnIf
510f7d6847SJulian Elischer.Fa thread
520f7d6847SJulian Elischerhas not terminated,
530f7d6847SJulian Elischer.Fn pthread_detach
54c6ff3a1bSSheldon Hearnwill not cause it to terminate.
55c6ff3a1bSSheldon HearnThe effect of multiple
560f7d6847SJulian Elischer.Fn pthread_detach
570f7d6847SJulian Elischercalls on the same target thread is unspecified.
580f7d6847SJulian Elischer.Sh RETURN VALUES
590f7d6847SJulian ElischerIf successful, the
600f7d6847SJulian Elischer.Fn pthread_detach
61c6ff3a1bSSheldon Hearnfunction will return zero.
62c6ff3a1bSSheldon HearnOtherwise an error number will be returned to
63c6ff3a1bSSheldon Hearnindicate the error.
64c6ff3a1bSSheldon HearnNote that the function does not change the value
65c6ff3a1bSSheldon Hearnof errno as it did for some drafts of the standard.
66c6ff3a1bSSheldon HearnThese early drafts
67c6ff3a1bSSheldon Hearnalso passed a pointer to pthread_t as the argument.
68c6ff3a1bSSheldon HearnBeware!
690f7d6847SJulian Elischer.Sh ERRORS
709d09157aSPhilippe CharnierThe
710f7d6847SJulian Elischer.Fn pthread_detach
729d09157aSPhilippe Charnierfunction will fail if:
730f7d6847SJulian Elischer.Bl -tag -width Er
740f7d6847SJulian Elischer.It Bq Er EINVAL
750f7d6847SJulian ElischerThe implementation has detected that the value specified by
760f7d6847SJulian Elischer.Fa thread
770f7d6847SJulian Elischerdoes not refer to a joinable thread.
780f7d6847SJulian Elischer.It Bq Er ESRCH
790f7d6847SJulian ElischerNo thread could be found corresponding to that specified by the given
800f7d6847SJulian Elischerthread ID,
810f7d6847SJulian Elischer.Fa thread .
820f7d6847SJulian Elischer.El
830f7d6847SJulian Elischer.Sh SEE ALSO
840f7d6847SJulian Elischer.Xr pthread_join 3
850f7d6847SJulian Elischer.Sh STANDARDS
869d09157aSPhilippe CharnierThe
870f7d6847SJulian Elischer.Fn pthread_detach
889d09157aSPhilippe Charnierfunction conforms to
89096841ecSRuslan Ermilov.St -p1003.1-96 .
90