An exit list is a list of routines that are given control when the current process ends, either normally or abnormally. The following is an example of exit list processing:
#define ROUTINE_ORDER 0x1000 usResult = DosExitList (EXLST_ADD | ROUTINE_ORDER, (PFNEXITLIST)MyExitProc);
This adds the function MyExitProc to the list of functions that are called when this process terminates (either normally or because of some error such as a General Protection fault).
usResult = DosExitList (EXLST_EXIT, (PFNEXITLIST)MyExitProc);
This allows the operating system to transfer control to the next function in the list of exit list processing functions for the process that has terminated. For more information, refer to DosExitList in the OS/2 Control Program Programming Reference and OS/2 Programming Guide.
At Enable time, the presentation driver must place an entry in the exit list for the application or process that opens the DC. This entry is a pointer identifying the routine in the presentation driver that releases all resources owned by the DC.
Note:
When writing a presentation driver, consider what would happen if another thread of the process were to terminate.