This function serializes the use of resource names among multiple IMOD tasks.
The ENQUEUE() function has this syntax:
ENQUEUE({ENQ|DEQ},,{COND|UNCOND|TEST},{EXCL|CONT|SHR},qname,rname,[shrcount])
Parameters
The ENQUEUE() function takes these arguments:
Reserves control of a resource.
Releases control of a resource.
Indicates a conditional request. Returns control to the IMOD immediately. Check the return code to find if you have gained control or if the ownership of another IMOD of the resource has prevented it.
Indicates an unconditional request. If the requested resource is not immediately available, your IMOD is placed in a wait state until the resource becomes available. When return is made, you have control of the resource (or an error condition was detected).
Tests the specified request. Returns control immediately, and the results indicate whether the request would have succeeded.
Requests an exclusive enqueue. No other users can hold an enqueue of any type for the resource.
Requests an enqueue for control of the resource. Only one CONT requestor can hold a resource, but multiple SHR users can hold an enqueue simultaneously with the single CONT user.
Requests a shared enqueue. Any number of requestors can hold an SHR enqueue simultaneously.
A one to eight character name (case-sensitive), which is used to group requests. Do not begin qnames (except as assigned by CA) with a dollar sign ($).
A 1 through 256 character name (case-sensitive), which is used to define fully a resource within a qname group. Do not begin Rnames (except as assigned by CA) with a dollar sign ($).
For shared enqueues, the maximum number of users that can hold the enqueue simultaneously. The limit for one user is not enforced on another user. Therefore, all requestors of a specific enqueue specify the same value for shrcount.
Default: 0 (no limit)
Request |
Current "Owners" |
Enqueue Assigned? |
---|---|---|
SHR |
none SHR* CONTROL CONTROL,SHR EXCL |
Yes Yes Yes Yes No |
CONTROL |
none SHR CONTROL CONTROL,SHR EXCL |
Yes Yes No No No |
EXCL |
none SHR CONTROL CONTROL,SHR EXCL |
Yes No No No No |
* Multiple SHR owners can always be regarded as a single entity.
The ENQUEUE() function produces these return codes.
If ENQ or DEQ and option is TEST:
null (indicates request succeeds immediately)
REQUEST FOR ALREADY OWNED RESOURCE
RESOURCE NOT AVAILABLE
RESOURCE NOT OWNED
If ENQ and option is NOT TEST:
null (indicates resource now owned)
If DEQ and option is NOT TEST:
null (indicates owned resource successfully released)
ARG n MISSING OR INVALID
REQUEST FOR ALREADY OWNED RESOURCE
RESOURCE NOT AVAILABLE
RESOURCE NOT OWNED
ENQUEUE REQUEST CANCELED
(Although you requested an unconditional enqueue, your wait was terminated without you being assigned ownership.)
Example
/* Protect a pool of global (&) variables against multiple user updates. The qname of GLOBAL and rname of IMSGROUP are arbitrary, but are understood by all IMODs that will access the variables in question. */ x = enqueue('enq',,'uncond','excl','GLOBAL','IMSGROUP') if rc ^= 0 then signal error1 &ims_count = &ims_count + 1 /* Following additional processing, the enqueue will be automatically released when the IMOD task ends. */
Copyright © 2014 CA Technologies.
All rights reserved.
|
|