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

# pthread\_cleanup\_pop(3)

call the first cleanup routine

## NAME

**pthread\_cleanup\_pop** – call the first cleanup routine

## LIBRARY

POSIX Threads Library (libpthread, -lpthread)

## SYNOPSIS

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

*void*\

**pthread\_cleanup\_pop**(*int execute*);

## DESCRIPTION

The **pthread\_cleanup\_pop**() function pops the top cleanup routine off of the current threads cleanup routine stack, and, if *execute* is non-zero, it will execute the function. If there is no cleanup routine then **pthread\_cleanup\_pop**() does nothing.

The **pthread\_cleanup\_pop**() function is implemented as a macro that closes a block. Invocations of this function must appear as standalone statements that are paired with an earlier call of [pthread\_cleanup\_push(3)](/pthread_cleanup_push/3.md) in the same lexical scope.

## RETURN VALUES

The **pthread\_cleanup\_pop**() function does not return any value.

## ERRORS

None

## SEE ALSO

[pthread\_cleanup\_push(3)](/pthread_cleanup_push/3.md), [pthread\_exit(3)](/pthread_exit/3.md)

## STANDARDS

The **pthread\_cleanup\_pop**() function conforms to ISO/IEC 9945-1:1996 (“POSIX.1”).
