xref: /freebsd/share/man/man9/thread_exit.9 (revision 4543ef516683042d46f3bd3bb8a4f3f746e00499)
1.\"
2.\" Copyright (c) 2002 Julian Elischer
3.\" All rights reserved.
4.\"
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd July 5, 2002
28.Dt THREAD_EXIT 9
29.Os
30.Sh NAME
31.Nm thread_exit
32.Nd abandon current thread context
33.Sh SYNOPSIS
34.In sys/param.h
35.In sys/proc.h
36.Ft void
37.Fn thread_exit "void"
38.Sh DESCRIPTION
39The
40.Fn thread_exit
41function implements the machine independent prelude to a thread
42shutdown.
43It will not return, and will result in a call to
44.Xr mi_switch 9
45to schedule some other thread.
46.Pp
47.Fn thread_exit
48arranges to free all the resources of the thread, specifically the kernel
49stack.
50.Pp
51To protect the
52.Xr runqueue 9 ,
53.Fn thread_exit
54must be called with the
55.Va sched_lock
56mutex held.
57.Sh SEE ALSO
58.Xr mi_switch 9 ,
59.Xr mutex 9 ,
60.Xr runqueue 9 ,
61.Xr sleep 9
62