[This is preliminary documentation and subject to change.]
TerminateExtension is an optional entry point fucntion you can include in your extension. If you do provide this entry point, IIS will call it before removing the extension from memory. It is recommended that you use TerminateExtension to shut down any worker threads that your extension has used during processing.
The following code demonstrates shutting down an extension with the TerminateExtension function.