Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sem_unlock(2) — DG/UX 5.4R2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought



sem_unlock(2)                DG/UX 5.4 Rel. 2.01               sem_unlock(2)


NAME
       sem_unlock - unlock a semaphore

SYNOPSIS
       #include <semaphore.h>

       int semunlock (*sem)
            semt  *sem;

DESCRIPTION
       Use semunlock(2) to unlock a semaphore, making it available to other
       processes: sem is a valid semaphore descriptor returned by a prior
       seminit(2) call.

       If a process is blocked waiting for the semaphore to become
       available, semunlock calls the kernel to wake the process.  If two
       or more processes are blocked waiting for the semaphore, it goes to
       the process with the highest priority. See schedsetscheduler(2) for
       a description of the scheduling classes and priorities.

       Locking a semaphore decrements its value specified with seminit(2)
       and unlocking it increments the value. If the value is 0 or negative,
       the semaphore is unavailable to processes that want to lock it. Each
       time semunlock 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).

       This implementation of semunlock does not comply with the POSIX
       requirement that the function be re-entrant with respect to signals.
       Therefore, do not call semunlock in a signal-catching routine. If a
       process that gets interrupted while executing semunlock calls a
       signal-catching routine that executes semunlock, deadlock might
       result.

   Note
        * This routine is based on POSIX realtime extension document P1003.4
          draft 12. 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, semunlock returns 0. If unsuccessful, it returns -1
       and sets ERRNO to one of the following:

        EFAULT *sem is an invalid address.

        EINTR  Interrupted system call.



Licensed material--property of copyright holder(s)                         1




sem_unlock(2)                DG/UX 5.4 Rel. 2.01               sem_unlock(2)


        EINVAL sem is invalid.

        ENOSPC Unable to allocate enough memory.

SEE ALSO
       schedsetscheduler(2), semdestroy(2), seminit(2), semlock(2),
       semtrylock(2), semunlink(2).


















































Licensed material--property of copyright holder(s)                         2


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