Previous: , Up: Exchanging Data Packets in a Multithreaded Program   [Contents][Index]


6.4.4 Error Handling

An interaction side can have an error handler assigned to it. The error handler is a function called in the case of a failure in any Side API function that takes an argument of qsmm_side_t type and can return an error code of int type. The default error handler of an interaction side prints information on an occurred error to stderr and calls exit(2). If an interaction side does not have an error handler assigned (including the default error handler), or an error handler assigned to the interaction side does not terminate program execution and returns, a failed Side API function returns a corresponding error code.

Use the following functions to query or set an error handler for an interaction side.

Function: void qsmm_get_side_err_handler (qsmm_side_t side, qsmm_err_handler_func_t *func_p, void **param_pp)

This function retrieves information on an error handler assigned to an interaction side. If func_p is not NULL, the function sets *func_p to the pointer to the error handler function or to NULL if the interaction side does not have the error handler function assigned. If param_pp is not NULL, the function sets *param_pp to the user parameter of that error handler function.

Function: void qsmm_set_side_err_handler (qsmm_side_t side, qsmm_err_handler_func_t func, void *paramp)

This function assigns an error handler to an interaction side. The argument func specifies an error handler function. The argument paramp specifies the user parameter of this error handler function. If func is NULL, the interaction side does not use an error handler.

See Error Handling for a Multinode Model, for the description of qsmm_err_handler_func_t type for an error handler function.


Previous: , Up: Exchanging Data Packets in a Multithreaded Program   [Contents][Index]