Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (A-B)
Guardian Procedure Calls Reference Manual—522629-013
2-59
BINSEM_CREATE_ Procedure
•
Unlocked. A binary semaphore can have no lock on it.
•
Forsaken. A binary semaphore can be forsaken if it was locked by a process
that has terminated.
•
Binary semaphore operations
Operations on a binary semaphores are atomic: they finish one at a time and never
finish concurrently. The following procedures perform operations on binary
semaphores:
•
BINSEM_CREATE_ which creates, opens, and locks a binary semaphore. A
binary semaphore ID is returned for use with other operations.
•
BINSEM_OPEN_ which opens access to a binary semaphore. A binary
semaphore ID is returned for use with other operations.
•
BINSEM_LOCK_ which locks a binary semaphore.
•
BINSEM_UNLOCK_ which unlocks a binary semaphore.
•
BINSEM_CLOSE_ which closes access to a binary semaphore.
•
BINSEM_FORCELOCK_ which takes the lock from a process that has the
lock.
•
Binary semaphore procedures synchronize processes in the same processor
The binary semaphore procedures cannot be used to synchronize processes on
different processors. To synchronize distributed processes, use interprocess
messages or file locks as described in the
Guardian Programmer’s Guide.
•
Binary semaphore resource requirements
The maximum number of binary semaphores a process can have is 64. This
number is further limited by the avaliable space in the process file segment (PFS).
In the D30 RVU, each open occupies 4 bytes of the PFS.
The number of binary semaphores a processor can have open is equal to the
number of process control blocks.
Considerations
•
The create operation and the state of the binary semaphore
The binary semaphore is opened and locked by the calling process when the
binary semaphore is created.
Example
error := BINSEM_CREATE_( semid, security );
Note. There are additional considerations for privileged callers.