Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ waitsem(2) — Dell System V Release 4 Issue 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

opensem(2)

creatsem(2)



waitsem(2)     UNIX System V(Application Compatibility Package)      waitsem(2)


NAME
      waitsem, nbwaitsem - await and check access to a resource governed by a
      semaphore

SYNOPSIS
      cc [flag . . .] file . . . -lx

      waitsem(int semnum);

      nbwaitsem(int semnum);

DESCRIPTION
      waitsem gives the calling process access to the resource governed by the
      semaphore sem_num.  If the resource is in use by another process, waitsem
      will put the process to sleep until the resource becomes available;
      nbwaitsem will return the error ENAVAIL.  waitsem and nbwaitsem are used
      in conjunction with sigsem to allow synchronization of processes withing
      to access a resource.  One or more processes may waitsem on the given
      semaphore and will be put to sleep until the process which currently has
      access to the resource issues sigsem.  sigsem causes the process which is
      next in line on the semaphore's queue to be rescheduled for execution.
      The semaphore's queue is organized in First In, First Out (FIFO) order.

DIAGNOSTICS
      waitsem returns the value (int) -1 if an error occurs.  If sem_num has
      not been previously opened by a call to opensem or creatsem, errno is set
      to EBADF.  If sem_num does not refer to a semaphore type file, errno is
      set to ENOTNAM.  All processes waiting (or attempting to wait) on the
      semaphore return with errno set to ENAVAIL when the process controlling
      the semaphore exits without relinquishing control (thereby leaving the
      resource in an undeterminate state).  If a process does two waitsems in a
      row without doing a intervening sigsem, errno is set to EINVAL.

SEE ALSO
      opensem(2), creatsem(2).



















10/89                                                                    Page 1





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