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
}
 

Static Public Member Functions

static void exit (UT_ExitCode exit_code=EXIT_OK)
 Calls exit(), which implicitly leads to our callbacks being called. More...
 
static void exitWithSignalNumber (int signal_number)
 
static void exitWithSpecificCode (int exit_code)
 
static bool isExiting ()
 
static void runExitCallbacks ()
 
static int addExitCallback (void(*exitcallback)(void *data), void *data=0)
 
static int addEarlyExitCallback (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)
 Register a callback to shut down the QApplication object (if any). More...
 

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

Definition at line 36 of file UT_Exit.h.

Member Function Documentation

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

Adds a callback to the front 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 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 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, and standalone/i3dsphere.C.
static 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 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 bool UT_Exit::isExiting ( )
static

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

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

Register a callback to shut down the QApplication object (if any).

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.


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