 |
PK_SESSION_is_in_kernel_2 |
|
PK_ERROR_code_t PK_SESSION_is_in_kernel_2
(
--- returned arguments ---
PK_LOGICAL_t *const is_in_kernel, --- whether called from within the kernel
PK_LOGICAL_t *const is_protected, --- whether called from protected region
PK_LOGICAL_t *const is_subthread --- whether called from internal thread
)
This function returns whether it has been called from within the kernel or
from outside the kernel.
This function may be called at any time. Being only inside this function does
not constitute being inside the kernel. The argument 'is_protected' returns
whether kernel code being executed, if any, may change the model. The
argument 'is_subthread' returns whether the kernel is executing in an
internal Parasolid thread rather than that of the application (see
PK_SESSION_set_smp).
The action required for error recovery is indicated in the following table:
'is_in_kernel' 'is_protected'
-------------- --------------
PK_LOGICAL_false PK_LOGICAL_false execution is not within Parasolid.
No action required.
PK_LOGICAL_true PK_LOGICAL_false execution is within a lightweight PK
function, or an unprotected part of
a heavyweight PK function.
PK_SESSION_tidy should be called.
PK_LOGICAL_true PK_LOGICAL_true execution is within the protected part
of a heavyweight PK function or within
a KI function.
If 'is_subthread' is PK_LOGICAL_true,
the application must not longjump and
must call PK_SESSION_abort. The main
application may call PK_SESSION_tidy
when it regains control.
If 'is_subthread' is PK_LOGICAL_false,
both PK_SESSION_abort and
PK_SESSION_tidy should be called.
In either case, rollback must be used
to regain a valid model state.
PK_LOGICAL_false PK_LOGICAL_true Protection mechanism is corrupt or the
kernel interface has been by-passed.
PK_SESSION_abort may recover from this
condition.