System processing to run an asynchronous exit

Once scheduled by the SCHEDIRB or SCHEDXIT macro, the asynchronous exit routine is logically ready to be dispatched.

If the target TCB was waiting, the system brings the target TCB out of the wait state, and the exit routine processes when the task gets dispatched next (according to its dispatching priority). If the target TCB was running, the exit routine processes after the task gets preempted for reasons unrelated to the exit, such as a page fault, a WAIT macro, or expiration of the task time to run on the processor.

If you used SCHEDIRB with the RBPTR=rb addr option to use directed IRBs, the system allows the directed IRB to run directly prior to the specified RB. The system processes the asynchronous exit routine in the next dispatch of the task, unless a subsequent non-directed IRB was scheduled for the same task. In that case, the directed IRB's exit routine will still get control just before its target RB, but the target RB might not run next. A subsequent IRB could get control first.