|
Property |
Value |
|---|---|
|
Kind |
Server library, client library, or connection library |
|
Type |
Procedure (see below) |
|
Read |
Never |
|
Write |
Server libraries: only in an EXPORTLIBRARY statement in the server library program Client libraries: only in the library declaration Connection libraries: only in the connection library declaration |
|
Default |
Not applicable |
Explanation
The CHANGE attribute specifies a procedure that notifies the library process of any changes in the status of a particular connection. The person who implements the library program is responsible for writing this procedure (hereafter referred to as the CHANGE procedure).
The system passes parameters to the CHANGE procedure that identify the new state of the connection and the reason that the state is changing. The CHANGE procedure can notify the library process of the changed status by modifying global objects in the library.
The connection does not fully transition to the state reported by the CHANGE procedure until the CHANGE procedure exits. Therefore, it is important not to include statements in the CHANGE procedure that could cause the CHANGE procedure to enter any prolonged waiting state.
If an error or fault occurs in a CHANGE procedure and the new state is LINKING or LINKED, the system prevents the change in connection state from completing. Further, the error or fault is propagated to the requesting process (the process that initiated the linkage or delinkage that is in progress). If the requesting process does not include code to handle the fault, the system discontinues the requesting process.
Library Linkages
In general, the system does not permit CHANGE procedures to execute statements that cause a new library linkage to occur; such statements result in a failed linkage attempt. However, the system does permit CHANGE procedures to link to certain system libraries such as GENERALSUPPORT and MCPSUPPORT. When a statement in a CHANGE procedure links to a system library, the system does not execute any CHANGE or APPROVAL procedure that the linking process has declared for the system library itself.
Client Libraries and Server Libraries
A CHANGE procedure can be specified inside the server library program or inside the client program.
For server libraries, the CHANGE attribute can be assigned only in an EXPORTLIBRARY statement. For example, the following ALGOL statement specifies that when the current block freezes as a library, the procedure CHG1 should be used as the CHANGE procedure for that library:
EXPORTLIBRARY (CHANGE = CHG1);
When CHANGE is specified for a server library, the CHANGE procedure is executed whenever any client process finishes linking to, or starts delinking from, the library.
For client programs, the CHANGE attribute can be assigned only in a library declaration. In this case, the CHANGE procedure is executed whenever that particular client program finishes linking to or starts delinking from the library.
For server libraries and client libraries, the system invokes the CHANGE procedure only when the connection state changes to LINKED or to DELINKING. In some cases, it is possible that the system will invoke the CHANGE procedure more than once for the DELINKING state.
| Note: | A server library cannot determine its current number of clients by reading the LIBRARYUSERS task attribute inside the CHANGE procedure, because the MYSELF task variable does not refer to the server library process. Refer to the discussion of the MYSELF task variable later under this heading. |
Connection Libraries
The CHANGE attribute can be assigned only in a connection library declaration, and the CHANGE procedure must be declared inside the connection library block.
The CHANGE attribute can be assigned to the connection library on either side of a connection. That is, a CHANGE attribute can be specified in a connection library declaration regardless of whether that connection library is to be used in READYCL or LINKLIBRARY functions.
When a linkage attempt for a connection library fails, it does not go through the normal state progression from NOTLINKED to LINKING to LINKED to DELINKING and back to NOTLINKED. Instead, the connection library either does not undergo state transitions or traverses the states from LINKING to DELINKING and back to NOTLINKED.
MYSELF Task Variable
Currently, when the MYSELF task variable is used inside a CHANGE procedure, MYSELF refers to the process initiating the linkage or delinkage. This process is also referenced by the task-valued parameter ACTOR, which is described later under this heading.
| Note: | The meaning of the MYSELF task variable in CHANGE procedures is subject to change in future software releases. Therefore, it is preferable to use the ACTOR parameter instead of MYSELF in CHANGE procedures. |
Parameters and Return Value
The CHANGE procedure must have the following form:
PROCEDURE CHANGE (CONN_INDEX, NEW_STATE, REASON, ACTOR, IMDSED); VALUE CONN_INDEX, NEW_STATE, REASON, IMDSED; INTEGER CONN_INDEX, NEW_STATE, REASON; TASK ACTOR; BOOLEAN IMDSED;
The CHANGE procedure should read, but not modify, the procedure parameters. The following are the meanings of these parameters:

