GDSX Manual
Service Routines
Extended General Device Support (GDSX) Manual–134303
8-29
GET^CPSEM
Considerations
•
A task calling this procedure may be suspended.
•
The manner in which GET^CPSEM returns the values 0 or 1 is intended to allow
procedures that need to call Q^CP[X] to obtain the semaphore while still ensuring
that checkpointed information from related calls is sent to the backup in a single I/O.
For example, procedures P1 and P2 both require checkpointing and P2 calls P1. P1
is also called in other places. P1 might be coded as follows:
PROC P1;
BEGIN
INT P1^GOT^CP^SEM := GET^CPSEM;
.
.
CALL Q^CP(.....);
.
.
IF P1^GOT^CP^SEM THEN
BEGIN
CALL DO^CP;
CALL GIVE^CPSEM;
END;
END;
Similarly, P2 is:
PROC P2;
BEGIN
INT P2^GOT^CP^SEM := GET^CPSEM;
.
.
CALL Q^CP(.....);
CALL P1;
CALL Q^CP(.....);
.
.
IF P2^GOT^CP^SEM THEN
BEGIN
CALL DO^CP;
CALL GIVE^CPSEM;
END;
END;
The procedure that acquires the semaphore is responsible for sending the
accumulated checkpoint buffer to the backup.
Assume that the caller of P2 does not own the checkpoint semaphore. When P2 is
called, the initialization of p2^got^cp^sem thus acquires the semaphore and
p2^got^cp^sem is set to 1. When P1 is entered, GET^CPSEM is again called during
initialization of p1^got^cp^sem . In this case, the task already owns the checkpoint
semaphore, so p1^got^cp^sem is initialized to zero. P1 does not checkpoint the data
nor does it release the checkpoint semaphore, because p1^got^cp^sem is zero.