Your resource manager can provide exit routines to be invoked when
events occur for its interest in a context. Table 1 lists
the context services exit routines.
Table 1. Context Services
Exit RoutinesExit Routine |
Exit Number in:
Hexadecimal
(Decimal)
Equate Symbol
|
Event |
---|
CONTEXT_SWITCH |
2
(2)
CTX_SWITCH_EXIT
|
A call to the Switch_Context service or the termination of
a disassociated context |
END_CONTEXT |
4
(4)
CTX_END_CONTEXT_EXIT
|
A context is ending for any reason, including a call to the
End_Context service |
EOM_CONTEXT |
5
(5)
CTX_EOM_CONTEXT_EXIT
|
A context is ending because the address space associated with
it is ending. This exit routine is invoked before the END_CONTEXT
exit routine |
EXIT_FAILED |
1
(1)
CTX_EXIT_FAILED_EXIT
|
A context services exit routine failed |
PVT_CONTEXT_OWNER |
3
(3)
CTX_PRIVATE_CONTEXT_
OWNER
|
A work unit associated with a private context is ending |
These exit routines are optional. A resource manager could, for
example, use context services without any exit routine and call the
Express_Context_Interest service just to keep data in the context_interest_data area
the service provides. If, however, your resource manager does choose
to provide any context services exit routines, it must also provide
an EXIT_FAILED exit routine.
When a context ends, the exit routines that context services invokes,
and the order in which context services invokes the routines, depend
on:
- The type of context (privately-managed context or native context)
- The reason the context is ending
Figure 1 shows the conditions and the
order in which exit routines are invoked.
Figure 1. Order of Invocation for Context
Services Exit RoutinesFor a privately-managed context:
- When the task associated with the context ends:
- PVT_CONTEXT_OWNER
- CONTEXT_SWITCH (if the owner tells RRS to disassociate the context
from the task)
- END_CONTEXT
- When the address space associated with the context ends:
- PVT_CONTEXT_OWNER
- CONTEXT_SWITCH (if the owner tells RRS to disassociate the context
from the task — see note 1)
- EOM_CONTEXT
- END_CONTEXT (see note 2)
- When the context is not associated with a task and its owner ends:
- EOM_CONTEXT
- CONTEXT_SWITCH
- END_CONTEXT (see note 2)
- When the End_Context service was called to end a context associated
with a task:
- END_CONTEXT
- When the End_Context service was called to end a context not associated
with a task:
- CONTEXT_SWITCH
- END_CONTEXT
For a native context:
- When the task associated with the context ends:
- END_CONTEXT
- When the address space associated with the context ends:
- EOM_CONTEXT
- END_CONTEXT (see note 2)
- When the End_Context service was called to end the context:
- END_CONTEXT
Note: - If the PVT_CONTEXT_OWNER exit routine tells context services to
disassociate the context from the task, context services drives CONTEXT_SWITCH
exit routines. If any CONTEXT_SWITCH exit routine disallows the switch,
context services continues processing to end the context, but it changes
the reason for the context end to CTX_FORCED_END_OF_CONTEXT.
- During processing the end of an address space, context services
invokes the CONTEXT_SWITCH, EOM_CONTEXT, and PVT_CONTEXT_OWNER exit
routines before the RTM resource managers (RESMGRs).