MUTEX_$INTRO Domain/OS MUTEX_$INTRO
NAME
intro - mutually exclusive resource locking
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/mutex.h>
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/mutex.ins.pas';
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/mutex.ins.ftn'
DESCRIPTION
The mutex_$ calls allow processes that run on the same node mutually
exclusive access to shared resources.
The following is a list of the mutex_$ calls.
mutex_$init initialize a mutual exclusion lock record
mutex_$lock obtain a mutual exclusion lock
mutex_$unlock release a mutual exclusion lock
Mutually exclusive access is achieved via a lock/unlock protocol
respected by the processes sharing the resource. The status of the
mutual exclusion lock on a resource is maintained in a mutual exclusion
lock record that must be mapped into the address space of all processes
using the lock.
A process requests exclusive access to the resource by calling
mutex_$lock, and releases the lock by calling mutex_$unlock. For the
mutual exclusion mechanism to work, processes sharing a file system
object must not write to the object without first obtaining the lock.
Any process that successfully maps or opens a stream to an object with
write access can write to the object whether it has a mutual exclusion
lock or not. Mutual exclusion is not enforced by the file system; it is
a voluntary protocol that must be respected by the processes sharing the
object.
A mutual exclusion lock record contains an eventcount used by mutex_$lock
to determine when a previously held lock is available. A program should
not access mutual exclusion lock records directly because they are shared
with the system, and attempts to circumvent the mutex_$ interface will
lead to unexpected results.
Constants
mutex_$wait_forever
Used as an argument to mutex_$lock to prevent mutex_$lock from tim-
ing out a mutual exclusion lock request.
Data Types
mutex_$lock_rec_t
A mutual exclusion lock record.
15 8 7 0
______________________________________________________________
| lock_byte | NOT USED |
|_____________________________________________________________|
| lock_ec |
|_____________________________________________________________|
| lock_ec |
|_____________________________________________________________|
| lock_ec |
|_____________________________________________________________|
| NOT USED |
______________________________________________________________
15 0
lock_byte
A Boolean value indicating the status of a mutual exclusion
lock.
lock_ec
The mutual exclusion lock eventcount of type ec2_$eventcount.
SEE ALSO
ec2_$intro, ms_$intro.