Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sem_post(2) — DG/UX R4.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought



sem_post(2)                       SDK R4.11                      sem_post(2)


NAME
       sem_post - unlock a semaphore

SYNOPSIS
       #include <semaphore.h>

       int sempost (*sem)
            semt  *sem;

DESCRIPTION
       Use sempost(2) to unlock a semaphore:

        sem         is a valid semaphore address returned by a prior
                    seminit(2) or semopen(2) call.

       The sempost(2) function unlocks the semaphore referenced by sem by
       performing a semaphore unlock operation on the semaphore.  Unlocking
       a semaphore increments its value, which is initially specified with
       the seminit(2) or semopen(2) call.  Locking a semaphore decrements
       the value.  If the value is zero or less, the semaphore is
       unavailable to processes that want to lock it.

       If the resulting value is zero, there is at least one process blocked
       waiting for this semaphore.  In this case, the process which has been
       waiting the longest will return successfully from its call to
       semwait(2).

       If the resulting value is positive, then there were no processes
       blocked waiting for this semaphore to become available.

       Each time sempost is called, it increments the semaphore's value,
       and (except that the value will eventually overflow) there is no
       restriction on the number of times it may be called.  Thus, if more
       processes unlock than lock a semaphore, its value will be incremented
       beyond the initial value specified with seminit(2) or semopen(2).

       The process which calls sempost need not be a process which
       successfully called semwait(2).  However, POSIX does require that
       semaphores be used by cooperating processes.

       sempost is re-entrant with respect to signals and, in particular,
       may be invoked from a signal-catching function.

   Note
        * This routine is based on POSIX realtime extension document P1003.4
          draft 14. It is therefore subject to change.

        * Compilation of a source file using this routine requires that
          feature macro _POSIX4_DRAFT_SOURCE be defined.  This feature macro
          is not enabled by any other feature macro, nor does it enable any
          other feature macro.

        * The compiled routine must be linked to library librte.a.

RETURN VALUE
       If successful, sempost returns 0. If unsuccessful, it returns -1 and
       sets ERRNO to one of the following:

        EFAULT *sem is an invalid address.

        EINVAL sem is invalid.

SEE ALSO
       semdestroy(2), seminit(2), semclose(2), semopen(2),
       semunlink(2), semwait(2), semtrywait(2), semgetvalue(2).


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026