GDSX (Extended General Device Support) Manual

Service Routines
Extended General Device Support (GDSX) Manual529931-001
8-55
PSEM
Except for the following consideration, the syntax, condition code settings, and
considerations regarding this procedure are the same as given for the Guardian
procedure in the Guardian Procedure Calls Reference Manual.
Consideration
The PROCESS_STOP_ procedure prohibits an attempt by USCODE to stop the GDSX
process within which the task is running.
PSEM
The PSEM procedure acquires a semaphore associated with a shared resource.
PSEM is not used to acquire a checkpoint semaphore. The checkpoint semaphore is
acquired with the GET^CPSEM procedure.
status returned value
INT:value
indicates the outcome of the call. The value of status is one of the following:
If the semaphore was found to belong to another task, the following events take
place:
The caller’s TCB is linked onto the semaphore’s wait list.
The caller’s tcb.statex.wait^cause is set to 1.
The task waits on DISP^RESOURCE (see WAIT^EVENT).
Caution. Tasks may own multiple semaphores simultaneously; however, GDSX provides no
deadlock detection or resolution mechanism. Do not attempt to obtain a semaphore that you
already own. Doing this causes your task to wait forever for the owner to give it up. To avoid
this, you can compare the first element of the semaphore with the address of your TCB. If they
match, you own the semaphore.
Caution. A task is in an unstoppable state while it owns one or more semaphores. If the task
faults while in an unstoppable state, the primary GDSX process stops.
status := PSEM ( semaphore !
i
,[ time ] ); !
i
0 There was a timeout before the semaphore was obtained
1 The semaphore was obtained