Next: , Up: handlers   [Contents][Index]


5.1 Handlers type definitions

All the following definitions are accessible from the header file ccexceptions.h.

Struct Typedef: cce_clean_handler_t
Struct Typedef: cce_error_handler_t

Opaque structures representing clean and error handlers. Instances of this type:

Clean handlers are invoked by calling one of the functions: cce_run_body_handlers(), cce_run_catch_handlers() and its variants cce_run_catch_handlers_final() and cce_run_catch_handlers_raise().

Error handlers are invoked by calling the function cce_run_catch_handlers() or one of its variants, cce_run_catch_handlers_final() and cce_run_catch_handlers_raise().

When an exception is raised: both the clean handlers and the error handlers are invoked; the clean handlers are invoked first, in reverse order with respect of their registration; the error handlers are invoked last, in reverse order with respect of their registration.

It is strongly advised to allocate instances of these types on the call stack, near the associated cce_location_t instance, rather than to put them into dynamically allocated memory.

Function Typedef: void cce_clean_handler_fun_t (cce_condition_t const * C, cce_clean_handler_t const * H)
Function Typedef: void cce_error_handler_fun_t (cce_condition_t const * C, cce_error_handler_t const * H)

Type of exception handler functions meant to release some asynchronous resource. The argument C references a structure representing the raised exceptional–condition object; the handler must leave it untouched, it must not mutate or release it. The argument H references the handler context; the handler must leave it untouched, it must not mutate it.

This function might call the destructor function registered in H, if any.

If an error occurs: the handler function must take care of itself and return to the caller, it must not raise an exceptional condition and jump to a remote location.

Typedef: cce_resource_data_t

An alias for void. We can use it in pointer cast operations to make the code more readable.

Function Typedef: void cce_resource_destructor_fun_t (cce_resource_data_t * pointer)

Type of client data destructor functions meant to destroy some ansynchronous resource. The argument pointer references the client data to destroy.

If an error occurs destroying some data: the destructor function must take care of itself and return to the caller, it must not raise an exceptional condition and jump to a remote location.

Preprocessor Macro: cce_resource_data_t * cce_resource_pointer (POINTER)

Cast the POINTER to cce_resource_data_t * and return it. We can use this macro to make the code more readable when initialising exception handlers.

Preprocessor Macro: cce_resource_destructor_fun_t * cce_resource_destructor (POINTER)

Cast the POINTER to cce_resource_destructor_fun_t * and return it. We can use this macro to make the code more readable when initialising exception handlers.


Next: , Up: handlers   [Contents][Index]

This document describes version 0.9.0-devel.3 of CCExceptions.