---
name: "thr_exit"
section: "2freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/thr_exit/2freebsd"
---

# thr\_exit(2freebsd)

terminate current thread

## NAME

**thr\_exit** – terminate current thread

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/thr.h\>**

*void*\

**thr\_exit**(*long \*state*);

## DESCRIPTION

This function is intended for implementing threading. Normal applications should call [pthread\_exit(3)](/pthread_exit/3.md) instead.

The **thr\_exit**() system call terminates the current kernel-scheduled thread.

If the *state* argument is not NULL, the location pointed to by the argument is updated with an arbitrary non-zero value, and an [\_umtx\_op(2)](/_umtx_op/2.md) UMTX\_OP\_WAKE operation is consequently performed on the location.

Attempts to terminate the last thread in the process are silently ignored. Use [\_exit(2)](/_exit/2.md) syscall to terminate the process.

## RETURN VALUES

The function does not return a value. A return from the function indicates that the calling thread was the last one in the process.

## SEE ALSO

[\_exit(2)](/_exit/2.md), [thr\_kill(2)](/thr_kill/2.md), [thr\_kill2(2)](/thr_kill2/2.md), [thr\_new(2)](/thr_new/2.md), [thr\_self(2)](/thr_self/2.md), [thr\_set\_name(2)](/thr_set_name/2.md), [\_umtx\_op(2)](/_umtx_op/2.md), [pthread\_exit(3)](/pthread_exit/3.md)

## STANDARDS

The **thr\_exit**() system call is non-standard and is used by library “libthr” to implement IEEE Std 1003.1-2001 (“POSIX.1”) [pthread(3)](/pthread/3.md) functionality.
