ENQ (Enqueue a Task) Macro

A task protects a resource by issuing an ENQ (enqueue) macro.

When the ENQ macro is issued, the task requesting the resource either continues its execution, or if the requested resource is held by another task, is placed in a wait state. When the task holding that resource completes, that task issues the DEQ (dequeue) macro. All other tasks that are then waiting for the dequeued resource are freed from their wait state, and the highest-priority task either obtains or maintains control.

If a task is terminated without dequeuing its queued resources, any task subsequently trying to queue that resource is abnormally terminated. If a task issues two ENQs without an intervening DEQ for the same resource, the task is canceled. Also, any task that does not control a resource but attempts to dequeue that resource is terminated, unless DEQ appears in the abnormal termination routine, in which case it is ignored.

Although the main task does not require the program to set up a task-to-task communication ECB to queue and dequeue, every subtask using the facility must have the ECB operand in the ATTACH macro. That ECB must not be used for any other purpose. Also, a resource can be protected only within the partition containing the ECB.
Note: Do not use the ENQ macro in your AB exit routine, since a deadlock might occur.

The ENQ macro supports the 31-bit environment. ENQ can be issued in 24-bit or 31-bit addressing mode, above or below the 16 MB line.

When ENQ is issued in AMODE 24, the RCB address is treated as a 24-bit address. When ENQ is issued in AMODE 31, the RCB address is treated as a 31-bit address.

Format

Read syntax diagramSkip visual syntax diagramnameENQrcbname(0)

Requirements for the caller

AMODE:
24 or 31
RMODE:
24 or ANY
ASC Mode:
Primary

Parameters

rcbname | 0
Specifies the address of the RCB.