IBM OS/390 User Manual

Page of 673
terminate normally. MVS does not permit the subtask to issue its own DETACH. If
neither ECB nor ETXR is specified in the ATTACH, the subtask is removed from
the system automatically at normal termination. In this case, no DETACH should
be issued.
13.2.2.2 WAIT/POST Macros
The two operating systems provide macros that synchronize task execution if
one task or subtask depends upon the completion of another subtask.
Under VSE and MVS, the WAITM and WAIT macros, respectively, inform the
control program that the execution of an active task cannot continue until one or
more specific events, each represented by a different control block, have
occurred.
The POST macro signals completion of an event. A POST issued to an (ECB)
removes from the wait state a task waiting for the event to complete.
┌─────┬──────┬─────────────────────────────┐
│ VSE │ POST │ecbname ,SAVE= savearea
│(1)
(0)
├─────┼──────┼─────────────────────────────┤
│ MVS │ POST │ecbaddress ,comple─ion code
│ │(1-12) (2-12)
│ (0) │
└─────┴──────┴─────────────────────────────┘
ECBNAME: Provides the address of the particular event control block (ECB)
representing the event posted as complete. The MVS ecbaddress parameter is
the equivalent.
SAVE: If this operand is present, only the task identified by the address of its
save area is taken out of the wait state. Although time is saved when specifying
this operand, other tasks waiting for this ECB are not taken out of the wait state
for this event until another POST is issued.
When a POST is issued without the SAVE operand, all tasks waiting for the ECB
are taken out of the wait state, and the highest-priority task regains control. You
can use the completion code parameter of the MVS POST macro to pass
information to the waiting subtask or tasks. These tasks can then interrogate the
code set in the ECB to determine a continuation of the wait or a return to
execution.
┌─────┬──────┬────────────────────────────────────┐
ecb1,ecb2,...
│ VSE │ WAIT │
lis─name
(1)
├─────┼──────┼────────────────────────────────────┤
│ MVS │ WAIT │
number of even─s,ECB = address
(2-12)
(1-12)
│ │ (0)
ECBLIST=address
│ │
(1-12)
└─────┴──────┴────────────────────────────────────┘
The systems provide different facilities. Because of the use of ECB bits under
MVS, only one WAIT macro can refer to an ECB at one time. An additional MVS
facility, specified through the number of events parameter, permits the task to be
taken out of the wait state after the specified number of events has been posted
Chapter 13. A s s e m b l e r
285