VMS exit handlers

 

Users can install exit handlers for an MQ application using the SYS$DCLEXH system service. The exit handler receives control when an image exits. An image exit will normally occur when you call the Exit ($EXIT) or Force Exit ($FORCEX) service. The $FORCEX will interrupt the target process in user mode. Then all user-mode exit handlers (established via $DCLEXH) will begin to execute in reverse order of establishment. For more details on exit handlers and $FORCEX, please refer to the VMS Programming Concepts Manual and the VMS System Services Manual.

If you call an MQI function from within an exit handler, the behavior of the function depends on the way the image was terminated. If the image was terminated while another MQI function is active, an MQRC_CALL_IN_PROGRESS will be returned.

It is possible to call an MQI function from within an exit handler if no other MQI function is active and upcalls are disabled for the MQ application. If upcalls are enabled for the MQ application, it will fail with the reason code MQRC_HCONN_ERROR.

The scope of an MQCONN or MQCONNX call is usually the thread that issued it. If upcalls are enabled, the exit handler will be run as a separate thread and the connection handles can not be shared.

Exit handlers are invoked within the interrupted context of the target process. It is up to the application to ensure that actions taken by a handler are safe and reliable, for the asynchronously interrupted context they are called from.

 

Parent topic:

Additional considerations


fg12015_