GDSX Manual
Service Routines
Extended General Device Support (GDSX) Manual–134303
8-42
INIT^XLIST
semaphore input
is either allocation of the semaphore in global memory, or a pointer to the
semaphore to be allocated in global or extended memory. All three elements of the
semaphore array must be equal to 0 at the time of call.
Examples
1. This example defines a semaphore my^resource in extended memory:
INT(32) .EXT MY^RESOURCE (SEM^TEMPLATE);
. !pointer to an extended memory area
@MY^RESOURCE := GETEXTPOOL(10,6)
MY^RESOURCE.SEMOWNER := MY^RESOURCE.SEMHEAD
:= MY^RESOURCE.SEMTAIL := 0D;
CALL INIT^SEM (MY^RESOURCE);
!Initialize semaphore structure which exists in
!local or extended memory
.
.
IF got^resource^sem := PSEM( MY^RESOURCE, 600 ) THEN
!Attempt to acquire the semaphore was successful
.
.
IF got^resource^sem THEN VSEM( MY^RESOURCE ); !release
!semaphore.
.
2. You may wish to define a semaphore to ensure serial I/O to a disk file. This can be
accomplished in the USER^INITIALIZE exit by calls to ^OPEN and INIT^SEM to
open the disk file and initialize a semaphore for the file. See the example in the
considerations for the ^OPEN procedure.
INIT^XLIST
For a description of the INIT^XLIST procedure, see “INIT^[X]LIST” on page 8-37.
INT:ref:3 (Semaphore in global memory)
INT(32) .EXT:ref (Pointer to semaphore in extended memory)
Caution. In general, the dynamic allocation of extended memory (with an extended pointer, for
example) should be avoided in USCODE because the TAL compiler would allocate such space
in extended segment ID 1024. Segment ID 1024 is reserved for TSCODE.