## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### Exit List Processing

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:

1.When the presentation driver's Enable Subfunction 01H - FillLogicalDeviceBlock is called, the driver can call function DosExitList:

    #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).

2.When MyExitProc is called, the presentation driver can perform any necessary cleanup such as releasing any semaphores. The last call in MyExitProc is another call to DosExitList:

             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.