Enclave termination

An enclave terminates when one of the following events occurs:
  • The last thread in the enclave terminates.
  • The main routine in the enclave returns to its caller through an implicit or explicit return.
  • An HLL construct issues a request for the termination of an enclave (for example, using the abort(), raise(SIGTERM), _exit(), or exit() functions of C).
  • When a severity 2 or greater condition remains unhandled, the thread terminates. When a thread terminates due to an unhandled condition, the enclave also terminates.
When an enclave terminates, Language Environment® releases resources allocated on behalf of the enclave and performs various other activities such as the following
  • Language Environment exception handlers are canceled.
  • All modules loaded by Language Environment are deleted.
  • All storage obtained by way of Language Environment services is freed.
  • All Language Environment control blocks for the enclave are freed.
  • Return code and reason code are set in R15 and R0, respectively.
  • The program mask and registers are restored to their values at the call to enclave initialization.
  • Control is returned to the enclave creator.