1fc2512cfSRobert Mustacchi.\" 2fc2512cfSRobert Mustacchi.\" This file and its contents are supplied under the terms of the 3fc2512cfSRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0. 4fc2512cfSRobert Mustacchi.\" You may only use this file in accordance with the terms of version 5fc2512cfSRobert Mustacchi.\" 1.0 of the CDDL. 6fc2512cfSRobert Mustacchi.\" 7fc2512cfSRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this 8fc2512cfSRobert Mustacchi.\" source. A copy of the CDDL is also available via the Internet at 9fc2512cfSRobert Mustacchi.\" http://www.illumos.org/license/CDDL. 10fc2512cfSRobert Mustacchi.\" 11fc2512cfSRobert Mustacchi.\" 12fc2512cfSRobert Mustacchi.\" Copyright (c) 2015, Joyent, Inc. 13fc2512cfSRobert Mustacchi.\" Copyright 2016 Joyent, Inc. 14fc2512cfSRobert Mustacchi.\" 15fc2512cfSRobert Mustacchi.Dd "Jan 13, 2015" 16fc2512cfSRobert Mustacchi.Dt THRD_DETACH 3C 17fc2512cfSRobert Mustacchi.Os 18fc2512cfSRobert Mustacchi.Sh NAME 19fc2512cfSRobert Mustacchi.Nm thrd_detach 20fc2512cfSRobert Mustacchi.Nd detach a thread 21fc2512cfSRobert Mustacchi.Sh SYNOPSIS 22fc2512cfSRobert Mustacchi.In threads.h 23fc2512cfSRobert Mustacchi.Ft int 24fc2512cfSRobert Mustacchi.Fo thrd_detach 25fc2512cfSRobert Mustacchi.Fa "thrd_t thrd" 26fc2512cfSRobert Mustacchi.Fc 27fc2512cfSRobert Mustacchi.Sh DESCRIPTION 28fc2512cfSRobert MustacchiThe 29fc2512cfSRobert Mustacchi.Fn thrd_detach 30fc2512cfSRobert Mustacchifunction causes a thread to be considered detached from the rest of the 3172d3dbb9SYuri Pankovexecution environment. 3272d3dbb9SYuri PankovWhile detached threads are still fully observable, they cannot be joined with, 3372d3dbb9SYuri Pankovcalls to 34fc2512cfSRobert Mustacchi.Fn thrd_join 3572d3dbb9SYuri Pankovwill fail. 3672d3dbb9SYuri PankovIn addition, if all non-detached threads have terminated, the program will 3772d3dbb9SYuri Pankovterminate; detached threads cannot keep a program running. 3872d3dbb9SYuri PankovThe act of calling 39fc2512cfSRobert Mustacchi.Fn thrd_detach 40fc2512cfSRobert Mustacchion a thread does not cause it to terminate. 41fc2512cfSRobert Mustacchi.Sh RETURN VALUES 42fc2512cfSRobert MustacchiUpon successful completion, the 43c66b8046SYuri Pankov.Fn thrd_detach 44fc2512cfSRobert Mustacchifunction returns 45fc2512cfSRobert Mustacchi.Sy thrd_success . 46fc2512cfSRobert MustacchiOtherwise, it returns 47fc2512cfSRobert Mustacchi.Sy thrd_error , 48fc2512cfSRobert Mustacchiindicating that an error has occurred. 49fc2512cfSRobert Mustacchi.Sh INTERFACE STABILITY 50fc2512cfSRobert Mustacchi.Sy Standard 51fc2512cfSRobert Mustacchi.Sh MT-LEVEL 52fc2512cfSRobert Mustacchi.Sy MT-safe 53fc2512cfSRobert Mustacchi.Sh SEE ALSO 54fc2512cfSRobert Mustacchi.Xr pthread_detach 3C , 55fc2512cfSRobert Mustacchi.Xr thrd_create 3C , 56fc2512cfSRobert Mustacchi.Xr thrd_join 3C , 57*bbf21555SRichard Lowe.Xr attributes 7 , 58*bbf21555SRichard Lowe.Xr threads 7 59