sema_post(3synch)


sema_post -- release a lock by incrementing the count value of the semaphore

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int sema_post(sema_t *sema);

Description

sema_post increments the count of the semaphore pointed to by sema, and if the new count value is less than or equal to zero, makes the next thread waiting at the semaphore runnable.

If more than one thread is waiting, release from the blocked group is scheduling policy-specific for bound threads, and might be dependent on scheduling parameters for multiplexed threads.

Parameters


sema
pointer to the semaphore to increment

sema parameter

sema must previously have been initialized, either by sema_init or statically (see sema_init(3synch)).

Return values

sema_post returns zero for success and an error number for failure.

Errors

If the following condition is detected, sema_post returns the corresponding value:

EINVAL
invalid argument specified

References

Intro(3synch), semaphore(3synch), sema_destroy(3synch), sema_init(3synch), sema_trywait(3synch), sema_wait(3synch)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004