sem_close.2   [plain text]


.\"	$Darwin$
.\"
.\" Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
.\"
.\" @APPLE_LICENSE_HEADER_START@
.\" 
.\" The contents of this file constitute Original Code as defined in and
.\" are subject to the Apple Public Source License Version 1.1 (the
.\" "License").  You may not use this file except in compliance with the
.\" License.  Please obtain a copy of the License at
.\" http://www.apple.com/publicsource and read it before using this file.
.\" 
.\" This Original Code and all software distributed under the License are
.\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
.\" License for the specific language governing rights and limitations
.\" under the License.
.\" 
.\" @APPLE_LICENSE_HEADER_END@
.\"
.Dd June 8, 2000
.Dt SEM_CLOSE 2
.Os Darwin
.Sh NAME
.Nm sem_close
.Nd close a named semaphore
.Sh SYNOPSIS
.Fd #include <semaphore.h>
.Ft int
.Fn sem_close "sem_t *sem"
.Sh DESCRIPTION
The system resources associated with the named semaphore referenced by
.Fa sem
are deallocated and the descriptor is invalidated.
.Pp
If successful,
.Fn sem_close
will return 0.  Otherwise, -1 is returned and
.Va errno
is set.
.Sh ERRORS
.Fn sem_close
succeeds unless:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa sem
is not a valid semaphore descriptor.
.El
.Sh SEE ALSO
.Xr sem_init 2 ,
.Xr sem_open 2 ,
.Xr sem_unlink 2 ,
.Xr semctl 2 ,
.Xr semget 2 ,
.Xr semop 2
.Sh HISTORY
.Fn sem_close
is specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995).