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