.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libc_r/man/pthread_cleanup_push.3,v 1.5.2.4 2001/08/17 15:42:51 ru Exp $
+.\" $FreeBSD$
.\"
-.Dd July 30, 1998
+.Dd October 25, 2014
.Dt PTHREAD_CLEANUP_PUSH 3
.Os
.Sh NAME
.Nm pthread_cleanup_push
.Nd add a cleanup function for thread exit
.Sh SYNOPSIS
-.Fd #include <pthread.h>
+.In pthread.h
.Ft void
-.Fo pthread_cleanup_push
-.Fa "void \*[lp]*routine\*[rp]\*[lp]void *\*[rp]"
-.Fa "void *arg"
-.Fc
+.Fn pthread_cleanup_push "void \*[lp]*cleanup_routine\*[rp]\*[lp]void *\*[rp]" "void *arg"
.Sh DESCRIPTION
The
.Fn pthread_cleanup_push
function adds
-.Fa routine
+.Fa cleanup_routine
to the top of the stack of cleanup handlers that
get called when the current thread exits.
.Pp
When
-.Fa routine
+.Fa cleanup_routine
is called, it is passed
.Fa arg
as its only argument.
+.Pp
+The
.Fn pthread_cleanup_push
-must be paired with a corresponding
-.Xr pthread_cleanup_pop 3
+function is implemented as a macro that opens a new block.
+Invocations of this function must appear as standalone statements that are
+paired with a later call of
+.Xr pthread_cleanup_pop 3
in the same lexical scope.
.Sh RETURN VALUES
+The
.Fn pthread_cleanup_push
-does not return any value.
+function does not return any value.
.Sh ERRORS
None
.Sh SEE ALSO
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
+The
.Fn pthread_cleanup_push
-conforms to
+function conforms to
.St -p1003.1-96 .