1*86f9d4cdStedu.\" $OpenBSD: pthread_cleanup_push.3,v 1.7 2013/06/05 03:44:50 tedu Exp $ 2e46ab3b7Sfgsch.\" 3a278733dSd.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com> 4a278733dSd.\" All rights reserved. 5a278733dSd.\" 6a278733dSd.\" Redistribution and use in source and binary forms, with or without 7a278733dSd.\" modification, are permitted provided that the following conditions 8a278733dSd.\" are met: 9a278733dSd.\" 1. Redistributions of source code must retain the above copyright 10a278733dSd.\" notice, this list of conditions and the following disclaimer. 11a278733dSd.\" 2. Redistributions in binary form must reproduce the above copyright 12a278733dSd.\" notice, this list of conditions and the following disclaimer in the 13a278733dSd.\" documentation and/or other materials provided with the distribution. 14a278733dSd.\" 3. Neither the name of the author nor the names of any co-contributors 15a278733dSd.\" may be used to endorse or promote products derived from this software 16a278733dSd.\" without specific prior written permission. 17a278733dSd.\" 18a278733dSd.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 19a278733dSd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20a278733dSd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21a278733dSd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22a278733dSd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23a278733dSd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24a278733dSd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25a278733dSd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26a278733dSd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27a278733dSd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28a278733dSd.\" SUCH DAMAGE. 29a278733dSd.\" 3074493c91Sd.\" $FreeBSD: pthread_cleanup_push.3,v 1.5 1999/08/28 00:03:02 peter Exp $ 3174493c91Sd.\" 32*86f9d4cdStedu.Dd $Mdocdate: June 5 2013 $ 33a278733dSd.Dt PTHREAD_CLEANUP_PUSH 3 34c043c0f7Sd.Os 35a278733dSd.Sh NAME 36a278733dSd.Nm pthread_cleanup_push 37a278733dSd.Nd add a cleanup function for thread exit 38a278733dSd.Sh SYNOPSIS 39*86f9d4cdStedu.In pthread.h 40a278733dSd.Ft void 41a278733dSd.Fn pthread_cleanup_push "void (*cleanup_routine)(void *)" "void *arg" 42a278733dSd.Sh DESCRIPTION 43a278733dSdThe 44a278733dSd.Fn pthread_cleanup_push 45a278733dSdfunction adds 46a278733dSd.Fa cleanup_routine 47a278733dSdto the top of the stack of cleanup handlers that 48a278733dSdget called when the current thread exits. 49a278733dSd.Pp 50a278733dSdWhen 51e46ab3b7Sfgsch.Fa cleanup_routine 52a278733dSdis called, it is passed 53a278733dSd.Fa arg 54a278733dSdas its only argument. 55a278733dSd.Sh RETURN VALUES 56a278733dSd.Fn pthread_cleanup_push 57a278733dSddoes not return any value. 58a278733dSd.Sh ERRORS 59a278733dSdNone 60a278733dSd.Sh SEE ALSO 61a278733dSd.Xr pthread_cleanup_pop 3 , 62a278733dSd.Xr pthread_exit 3 63a278733dSd.Sh STANDARDS 64a278733dSd.Fn pthread_cleanup_push 65e46ab3b7Sfgschconforms to 66e46ab3b7Sfgsch.St -p1003.1-96 . 67