---
name: "at_quick_exit"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/at_quick_exit"
---

# at\_quick\_exit(3)

registers a cleanup function to run on quick exit

## NAME

**at\_quick\_exit** – registers a cleanup function to run on quick exit

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<stdlib.h\>**

*int*\

**at\_quick\_exit**(*void (\*func)(void)*);

## DESCRIPTION

The **at\_quick\_exit**() function registers a cleanup function to be called when the program exits as a result of calling [quick\_exit(3)](/quick_exit/3.md). The cleanup functions are called in the reverse order and will not be called if the program exits by calling [exit(3)](/exit/3.md), [\_Exit(3)](/_Exit/3.md), or [abort(3)](/abort/3.md).

## RETURN VALUES

The **at\_quick\_exit**() function returns the value 0 if successful and a non-zero value on failure.

## SEE ALSO

[exit(3)](/exit/3.md), [quick\_exit(3)](/quick_exit/3.md)

## STANDARDS

The **at\_quick\_exit**() function conforms to ISO/IEC 9899:2011 (“ISO C11”).
