| iMatix home page | << | < | > | >> |
SMT Version 2.81 |
#include "smtlib.h" int smt_atexit (function handler)
Registers a termination function. The function is defined as a void function without arguments. The termination functions are called in the order that they are declared. Multiple instances of the same function are ignored. Returns 0 if okay, -1 if there was an error. In the case of an error, sets smt_errno to one of:
SMT NOTREADY | smt_init() was not called, or failed |
SMT OUTOFMEMORY | Not enough heap memory left |
{ EXITFCT *exitfct; /* Agent information block */ #if (defined (SMT_TRACE)) trace ("smt_atexit"); #endif ASSERT (handler); if (!smt_alive) /* If SMT API was not correctly */ { /* initialised, forget it */ smt_errno = SMT_NOTREADY; return (-1); } /* Check that exit function is not already defined; if so, ignore it */ FORLIST (exitfct, exitfcts) if (exitfct-> handler == handler) return (0); /* Allocate an EXITFCT block and attach it to the exitfcts list */ exitfct = (EXITFCT *) node_create (exitfcts.prev, sizeof (EXITFCT)); if (exitfct == NULL) { smt_errno = SMT_OUTOFMEMORY; return (-1); } exitfct-> handler = handler; return (0); }
| << | < | > | >> | Copyright © 1996-99 iMatix Corporation |