DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sema_post(SYNCH)


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(SYNCH)).

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(SYNCH), semaphore(SYNCH), sema_destroy(SYNCH), sema_init(SYNCH), sema_trywait(SYNCH), sema_wait(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005