1*512b5dedSjmc.\" $OpenBSD: sem_post.3,v 1.6 2023/02/11 21:13:56 jmc Exp $ 2a72c0c24Sfgsch.\" 32787694aSfgsch.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. 42787694aSfgsch.\" All rights reserved. 52787694aSfgsch.\" 62787694aSfgsch.\" Redistribution and use in source and binary forms, with or without 72787694aSfgsch.\" modification, are permitted provided that the following conditions 82787694aSfgsch.\" are met: 92787694aSfgsch.\" 1. Redistributions of source code must retain the above copyright 102787694aSfgsch.\" notice(s), this list of conditions and the following disclaimer as 112787694aSfgsch.\" the first lines of this file unmodified other than the possible 122787694aSfgsch.\" addition of one or more copyright notices. 132787694aSfgsch.\" 2. Redistributions in binary form must reproduce the above copyright 142787694aSfgsch.\" notice(s), this list of conditions and the following disclaimer in 152787694aSfgsch.\" the documentation and/or other materials provided with the 162787694aSfgsch.\" distribution. 172787694aSfgsch.\" 182787694aSfgsch.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 192787694aSfgsch.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 202787694aSfgsch.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 212787694aSfgsch.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 222787694aSfgsch.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 232787694aSfgsch.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 242787694aSfgsch.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 252787694aSfgsch.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 262787694aSfgsch.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 272787694aSfgsch.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 282787694aSfgsch.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 292787694aSfgsch.\" 302787694aSfgsch.\" $FreeBSD: src/lib/libc_r/man/sem_post.3,v 1.10 2001/10/01 16:09:09 ru Exp $ 31*512b5dedSjmc.Dd $Mdocdate: February 11 2023 $ 322787694aSfgsch.Dt SEM_POST 3 332787694aSfgsch.Os 342787694aSfgsch.Sh NAME 352787694aSfgsch.Nm sem_post 362787694aSfgsch.Nd increment (unlock) a semaphore 372787694aSfgsch.Sh SYNOPSIS 3886f9d4cdStedu.In semaphore.h 392787694aSfgsch.Ft int 402787694aSfgsch.Fn sem_post "sem_t *sem" 412787694aSfgsch.Sh DESCRIPTION 422787694aSfgschThe 432787694aSfgsch.Fn sem_post 442787694aSfgschfunction increments (unlocks) the semaphore pointed to by 452787694aSfgsch.Fa sem . 462787694aSfgschIf there are threads blocked on the semaphore when 472787694aSfgsch.Fn sem_post 482787694aSfgschis called, then the highest priority thread that has been blocked the longest on 492787694aSfgschthe semaphore will be allowed to return from 50*512b5dedSjmc.Xr sem_wait 3 . 512787694aSfgsch.Pp 522787694aSfgsch.Fn sem_post 532787694aSfgschis signal-reentrant and may be called within signal handlers. 542787694aSfgsch.Sh RETURN VALUES 552787694aSfgsch.Rv -std sem_post 562787694aSfgsch.Sh ERRORS 572787694aSfgsch.Fn sem_post 582787694aSfgschwill fail if: 592787694aSfgsch.Bl -tag -width Er 602787694aSfgsch.It Bq Er EINVAL 612787694aSfgsch.Fa sem 622787694aSfgschpoints to an invalid semaphore. 632787694aSfgsch.El 642787694aSfgsch.Sh SEE ALSO 659c42db49Sjmc.Xr sem_destroy 3 , 669c42db49Sjmc.Xr sem_getvalue 3 , 679c42db49Sjmc.Xr sem_init 3 , 689c42db49Sjmc.Xr sem_open 3 , 692787694aSfgsch.Xr sem_wait 3 702787694aSfgsch.Sh STANDARDS 712787694aSfgsch.Fn sem_post 722787694aSfgschconforms to 732787694aSfgsch.St -p1003.1-96 . 74