Call the Latch_Obtain service to request exclusive or shared ownership
of a latch. When a requestor owns a particular latch, the requestor
can use the resource associated with that latch. The following callable
services are related to Latch_Obtain:
- ISGLCRT
- Creates a latch set that an application can use to serialize resources.
- ISGLREL
- Releases ownership of an owned latch or a pending request to obtain
a latch.
- ISGLPRG
- Purges all granted and pending requests for a particular requestor
within a specific latch set.
In the following description of Latch_Obtain:
- The term requestor describes a task or SRB routine that
calls the Latch_Obtain service to request ownership of a latch.
- Constants defined in the latch manager IDFs are followed by their
numeric equivalents; you may specify either when coding calls to Latch_Obtain.
For example, “ISGLOBT_COND (value of 1)” indicates the constant ISGLOBT_COND
and its associated value, 1.
Write the call as shown on the syntax diagram. You must code all
parameters on the CALL statement in the order shown.
Assign values to the following parameters:
- latch_set_token
- latch_number
- requestor_ID
- obtain_option
- access_option
- ECB_address
Latch_Obtain returns values in the following parameters:
- latch_set_token
- return_code
Latch_Obtain uses the following parameter for temporary storage:
CALL statement |
Parameters |
---|
CALL ISGLOBT
|
(latch_set_token
,latch_number
,requestor_ID
,obtain_option
,access_option
,ECB_address
,latch_token
,work_area
,return_code)
|
The parameters are explained as follows:
- latch_set_token
- Specifies an 8-byte area that contains the latch_set_token that
the Latch_Create service returned earlier when it created the latch
set.
- ,latch_number
- Specifies a fullword integer that contains the number of the latch
to be obtained. The latch_number must be in the range from 0 to
the total number of latches in the associated latch set minus one.
- ,requestor_ID
- Specifies an 8-byte area that contains a value that identifies
the caller of the Latch_Obtain service. The requestor_ID can be any
value except all binary zeros.
Recovery routines can purge all
granted and pending requests for a particular requestor (identified
by a requestor_id) within a specific latch set. When specifying the
requestor_ID on Latch_Obtain, consider which latches would be purged
if the Latch_Purge service were to be called with the specified requestor_ID.
For more information about the Latch_Purge service, see ISGLPRG — Purge a requestor from a latch set.
- ,obtain_option
- A fullword integer that specifies how the system is to handle
the Latch_Obtain request if the latch manager cannot immediately grant
ownership of the latch to the requestor:
- ISGLOBT_SYNC (value of 0)
- The system processes the request synchronously. The system suspends
the requestor. When the latch manager eventually grants ownership
of the latch to the requestor, the system returns control to the requestor.
- ISGLOBT_COND (value of 1)
- The system processes the request conditionally. The system returns
control to the requestor with a return code of ISGLOBT_CONTENTION
(value of 4). The latch manager does not queue the request to obtain
the latch.
- ISGLOBT_ASYNC_ECB (value of 2)
- The system processes the request asynchronously. The system returns
control to the requestor with a return code of ISGLOBT_CONTENTION
(value of 4). When the latch manager eventually grants ownership of
the latch to the requestor, the system posts the ECB pointed to by
the value specified on the ECB_address parameter.
When you specify
this option, the ECB_address parameter must contain the address of
an initialized ECB that is addressable from the home address space
(HASN).
- ,access_option
- A fullword or character string that specifies the access required:
- ISGLOBT_EXCLUSIVE (value of 0) - Exclusive (write) access
- ISGLOBT_SHARED (value of 1) - Shared (read) access
- ,ECB_address
- Specifies a fullword that contains the address of an ECB. If you
specify an obtain_option of ISGLOBT_SYNC (value of 0) or ISGLOBT_COND
(value of 1) on the call to Latch_Obtain, the ECB_address field must
be valid (though its contents are ignored). IBM® recommends
that an address of 0 be used when no ECB is to be processed.
If
you specify an obtain_option of ISGLOBT_ASYNC_ECB (value of 2) and
the system returns a return code of ISGLOBT_CONTENTION (value of 4)
to the caller, the system posts the ECB pointed to by the value specified
on the ECB_address parameter when the latch manager grants ownership
of the latch to the requestor.
- ,latch_token
- Specifies an 8-byte area to contain the latch token returned by
the Latch_Obtain service. You must provide this value as a parameter
on a call to the Latch_Release service to release the latch.
- ,work_area
- Specifies a 256-byte work area that provides temporary storage
for the Latch_Obtain service. The work area should begin on a doubleword
boundary to optimize performance. The work area must be in the same
storage key as the caller of Latch_Obtain.
- ,return_code
- Specifies a fullword integer that is to contain the return code
from the Latch_Obtain service.