Harlequin RIP SDK
hqexcept.h File Reference

Harlequin standard code for handling exceptions and signals. More...

Functions

void HqCatchExceptions (void(*func)(char *))
 Install a callback function to handle exceptions that will terminate the process. Also block SIGINT, SIGTERM and SIGCHLD. More...
 
void HqCStacks (char *title)
 A debug function to print the current call stacks for all threads. More...
 

Detailed Description

Harlequin standard code for handling exceptions and signals.

Copyright (C) 2017 Global Graphics Software Ltd. All rights reserved. This source code contains the confidential and trade secret information of Global Graphics Software Ltd. It may not be used, copied or distributed for any reason except as set forth in the applicable Global Graphics license agreement.

The functions in this file are used to catch exceptions that cause a process termination, and to capture and print debug information about those exceptions.

Function Documentation

◆ HqCatchExceptions()

void HqCatchExceptions ( void(*)(char *)  func)

Install a callback function to handle exceptions that will terminate the process. Also block SIGINT, SIGTERM and SIGCHLD.

Parameters
[in]funcA pointer to a callback function, called if one of the following exceptions is caught:

SIGILL, SIGSEGV, SIGFPE, SIGBUS, SIGSYS

These would normally terminate the process. The callback function takes one parameter, a zero-terminated message string describing the exception information. This message string should be output to a suitable debug information channel.

This function also masks SIGINT, SIGTERM and SIGCHLD using the pthread_sigmask() pthread API. This is so that new threads created after this function is called will inherit those thread signal masks. This function ought to be called before any of the RIP start up functions are called. Trapping Ctrl-C can then be done in the thread which called this function.

◆ HqCStacks()

void HqCStacks ( char *  title)

A debug function to print the current call stacks for all threads.

Parameters
[in]titleA zero-terminated string that will be output before the call stack information.