MUTEX_$INIT Domain/OS MUTEX_$INIT
NAME
mutex_$init - initialize a mutual exclusion lock record
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/mutex.h>
extern void mutex_$init(mutex_$lock_rec_t *lock_record)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/mutex.ins.pas';
procedure mutex_$init(out lock_record: mutex_$lock_rec_t);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/mutex.ins.ftn'
integer*2 lock_record(4), lock_ec_awaiters
integer*4 lock_ec_value
character*1 lock_byte
equivalence (lock_byte, lock_record(1))
equivalence (lock_ec_value, lock_record(2))
equivalence (lock_ec_awaiters, lock_record(4))
call mutex_$init(lock_record)
DESCRIPTION
Mutex_$init initializes a mutual exclusion lock record. An initialized
mutual exclusion lock record must be mapped into the address space of all
processes using the lock. The object of the mutual exclusion lock and
the lock record itself, and any other data shared by the processes using
the lock, may be mapped in the same object.
This is the usual way to initialize a mutual exclusion lock record:
1. Map a file large enough to hold a lock record with an exclusive
write lock to ensure that the map will fail if another process
simultaneously attempts to initialize the lock record by map-
ping the file the same way.
2. Call mutex_$init to initialize the lock record and register its
eventcount with the system.
3. Remap or relock the lock record object so that other processes
can map it for shared write access.
lock_record
A mutual exclusion lock record.
SEE ALSO
ms_$crmapl, ms_$relock, and ms_$remap.