Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mutex(2) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

mutex(2)                                                           mutex(2)

NAME
     mutex - ABI entry points for mutual exclusion

SYNOPSIS
     cc [flag ...] file ... -lmutex [library ...]

     #include <abimutex.h>

     void initlock(abilockt *lck)

     int acquirelock(abilockt *lck)

     void releaselock(abilockt *lck)

     int statlock(abilockt *lck)

DESCRIPTION
     These functions supply a user-level interface to mutual exclusion
     locks. The parameter lck must point to memory shared by all processes
     wishing to acquire or test the lock.

     The contents of the structure abilockt are as follows:

        typedef struct {
            volatile unsigned long    abilock;
        } abilockt;

     The function initlock must be called on a lock before any of the
     other functions. It initializes the lock to an unlocked state.

     acquirelock attempts to acquire the lock referenced by lck. It
     returns zero if the lock was acquired, otherwise non-zero.

     statlock returns the current state of the lock referenced by lck
     without attempting to acquire the lock. It returns zero if the lock is
     free, otherwise non-zero.

     releaselock unconditionally releases the lock pointed to by lck.

NOTES
     No locks are ever freed automatically by the system. Locks acquired by
     a process that dies remain locked.

     The user is responsible for implementing a back-off policy if
     acquirelock returns failure.

     Even though statlock returns a status indicating that the lock is
     available, a call to acquirelock could still fail.

     The contents of the lock pointed to by lck should not be examined
     directly.




Page 1                       Reliant UNIX 5.44                Printed 11/98

mutex(2)                                                           mutex(2)

     On RM400-5 systems, these functions are available only to the
     superuser or to users with the privilege to use preemption control
     [see pfenable(1M)]. On these systems, the loader flags -lmproc and
     -lext must be specified in addition to -lmutex.


















































Page 2                       Reliant UNIX 5.44                Printed 11/98

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