Distributed Systems Network Management (DSNM) Subsystem Interface Development Guide

Altering the Current Thread Procedure and Thread
State
3-40
109759Distributed Systems Network Management (DSNM) Subsystem Interface
Development Guide
I Process Development Process
Determining and Setting the Current Thread State:
_THREAD^STATE
The frame sets the thread state to _ST^INITIAL when it creates a thread. Subsequently,
you may set the thread state as desired; the frame never uses it again. The current thread
state can be tested or set with _THREAD^STATE.
The following example tests the current state of the thread:
CASE _THREAD^STATE OF
BEGIN
_ST^INITIAL ->
...
OTHERWISE ->
...
END;
Currently, _ST^INITIAL is the only reserved thread state value.
Defining Thread States: _ST^MIN^THREAD^STATE
Thread state values are always nonnegative. The literal _ST^MIN^THREAD^STATE is
the minimum value to which a user-defined thread state can be set. Use this literal to
define thread states.
The following example declares several thread states and then sets the current thread
state:
LITERAL thr^state1 = _ST^MIN^THREAD^STATE, thr^state2,
thr^state3;
.
.
.
_THREAD^STATE := thr^state2;
Saving and Restoring Current Thread Procedure and State Values:
_PUSH^THREAD^PROCSTATE and
_POP^THREAD^PROCSTATE
_PUSH^THREAD^PROCSTATE and _POP^THREAD^PROCSTATE allow you to save
and restore the current thread procedure and thread state.
_PUSH^THREAD^PROCSTATE saves the current thread procedure and thread state. It
optionally sets new values for the current thread procedure and thread state.
_POP^THREAD^PROCSTATE restores the saved values.
In the following example, the frame dispatches PROC^X of the command thread in
_ST^INITIAL.
error := _PUSH^THREAD^PROCSTATE ( [ @procname ] ,[ state ] );
error := _POP^THREAD^PROCSTATE ;