HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Exit Class Reference

#include <UT_Exit.h>

Public Types

enum  UT_ExitCode {
  EXIT_OK = 0, EXIT_GENERIC_ERROR = 1, EXIT_BUILTIN_ERROR = 2, EXIT_LICENSE_ERROR = 3,
  EXIT_SOCKET_ERROR = 4, EXIT_PARSE_UI_ERROR = 5, EXIT_SSL_ERROR = 64, EXIT_PROCESS_RUN_ERROR = 100
}
 

Static Public Member Functions

static SYS_FUNC_NORETURN void exit (UT_ExitCode exit_code=EXIT_OK)
 Calls exit(), which implicitly leads to our callbacks being called. More...
 
static SYS_FUNC_NORETURN void exitWithSignalNumber (int signal_number)
 
static SYS_FUNC_NORETURN void exitWithSpecificCode (int exit_code)
 
static SYS_FUNC_NORETURN void success ()
 Synonym for exit(UT_Exit::EXIT_OK). More...
 
static SYS_FUNC_NORETURN void fail (const UT_ExitCode exit_code=EXIT_GENERIC_ERROR)
 Synonym for exit(UT_Exit::EXIT_GENERIC_ERROR) More...
 
static bool isExiting ()
 
static bool isImplicitlyExiting ()
 
static void runExitCallbacks ()
 
static int addExitCallback (void(*exitcallback)(void *data), void *data=0)
 
static int removeExitCallback (void(*exitcallback)(void *data), void *data=0)
 
static void removeAllExitCallbacks ()
 Remove all the exit callbacks. More...
 
static void registerQtAppExitCallback (void(*exitcallback)(void *data), void *data=nullptr)
 
static void registerPyAtExitCallback (void(*exitcallback)(void *data), void *data=nullptr)
 

Detailed Description

Definition at line 20 of file UT_Exit.h.

Member Enumeration Documentation

The enumeration of the exit codes that Houdini producs can use. (see notes in http://tldp.org/LDP/abs/html/exitcodes.html)

Note
The numeric values for the specific exit reasons should not change: some customers explicitly test the numeric value of the exit code and take a specific action based on it. E.g., they may test the exit code for the license failure on a render farm for re-submission, but if we change the exit code for license failure their scripts will need to be updated to account for that.
Don't use exit code value of 259. On Windows, the exit code 259 means STILL_ACTIVE, and should not be used as an exit error code; otherwise the return value of GetExitCodeProcess() calls may be misinterpreted.
Enumerator
EXIT_OK 

no error

EXIT_GENERIC_ERROR 

catch-all error code

EXIT_BUILTIN_ERROR 

misuse of shell builtins (according to Bash documentation)

EXIT_LICENSE_ERROR 

failure to check out or verify an appropriate product license

EXIT_SOCKET_ERROR 

socket communication failure

EXIT_PARSE_UI_ERROR 

failed to parse the UI definition file

EXIT_SSL_ERROR 

SSL related error.

EXIT_PROCESS_RUN_ERROR 

Process is already running.

Definition at line 36 of file UT_Exit.h.

Member Function Documentation

static int UT_Exit::addExitCallback ( void(*)(void *data exitcallback,
void data = 0 
)
static

Adds a callback to the end of the list of callbacks to be run when the process exits. Returns 1 if the function was added, the function can only be added one time. Returns 0 if this is a duplicate.

Warning
Destructors of global variables are called BEFORE the callback is invoked on Windows!
static SYS_FUNC_NORETURN void UT_Exit::exit ( UT_ExitCode  exit_code = EXIT_OK)
static

Calls exit(), which implicitly leads to our callbacks being called.

Examples:
standalone/dsmprint.C, standalone/geoisosurface.C, and standalone/i3dsphere.C.
static SYS_FUNC_NORETURN void UT_Exit::exitWithSignalNumber ( int  signal_number)
static

Just like exit(), except sets the exit code to the properly offset signal number according to the convention: 128 + signal_number.

static SYS_FUNC_NORETURN void UT_Exit::exitWithSpecificCode ( int  exit_code)
static

An exit method that takes any exit code (as integer). Should be used sparingly and only if necessary. We want the exit codes to be consistent, stable and well-known to the customers (we can document based on the above enum), so use exit() with UT_ExitCode, if possible.

static SYS_FUNC_NORETURN void UT_Exit::fail ( const UT_ExitCode  exit_code = EXIT_GENERIC_ERROR)
inlinestatic

Synonym for exit(UT_Exit::EXIT_GENERIC_ERROR)

Examples:
standalone/standalone.C.

Definition at line 85 of file UT_Exit.h.

static bool UT_Exit::isExiting ( )
static

Return true if the application is in the process of exiting and false otherwise.

static bool UT_Exit::isImplicitlyExiting ( )
static

Return true if process is implicitly exiting, ie. from normal process termination. This will be false when exit callbacks are being run prior to process termination.

static void UT_Exit::registerPyAtExitCallback ( void(*)(void *data exitcallback,
void data = nullptr 
)
static

Register a callback to run Python's atexit callbacks. DO NOT CALL THIS FUNCTION. The function should only be called by pyInitializePython() in PY_InterpreterAutoLock.C. If you want to register a Python exit callback, then call PYregisterAtExitCallback() from PY_Python.h instead.

static void UT_Exit::registerQtAppExitCallback ( void(*)(void *data exitcallback,
void data = nullptr 
)
static

Register a callback to shut down the QApplication object (if any). DO NOT CALL THIS FUNCTION. The function should only be called by main() in AP_Main.C.

static void UT_Exit::removeAllExitCallbacks ( )
static

Remove all the exit callbacks.

static int UT_Exit::removeExitCallback ( void(*)(void *data exitcallback,
void data = 0 
)
static

Returns 1 if the function was removed. Returns 0 if the function was never added.

static void UT_Exit::runExitCallbacks ( )
static

Calls our callbacks directly, without calling exit(). This should only be used by our core dump handler.

static SYS_FUNC_NORETURN void UT_Exit::success ( )
inlinestatic

Synonym for exit(UT_Exit::EXIT_OK).

Definition at line 78 of file UT_Exit.h.


The documentation for this class was generated from the following file: