GDSX (Extended General Device Support) Manual

Service Routines
Extended General Device Support (GDSX) Manual529931-001
8-43
INIT^XLIST
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 on page 8-52.
INIT^XLIST
For a description of the INIT^XLIST procedure, see INIT^[X]LIST on page 8-41.
INSERT^[X]ITEM
The INSERT^ITEM and INSERT^XITEM procedures insert an item into a linked list.
INSERT^ITEM is intended for use with lists in global memory, while INSERT^XITEM is
intended for lists in extended memory.
address1 input
is the address of an element on the list. To make an item addressed by address2
the first item on the list, address1 should specify the address of the list header.
CALL INSERT^[X]ITEM ( address1 !
i
,address2 ); !
i
INT:value (Use with INSERT^ITEM.)
INT(32):value (Use with INSERT^XITEM.)