Click or drag to resize

Understanding the Shutdown Sequence

Just as the initialization of an IVI-COM driver proceeds in distinct steps, so does the the shutdown process proceed in an orderly fashion. Nimbus provides two functions that can be used to customize the driver shutdown process.

To understand how to customize the driver shutdown process, consider the simple C# client code used to instantiate, initialize, and finally close the Acme4321 IVI-COM driver.

C#
// Create an instance of the driver
IAcme4321 driver = new Acme4321();

// Initialize the driver
driver.Initialize("GPIB::15", true, true, "");

// ... call various methods/properties on the driver

// Close the driver
driver.Close();

When the code above executes, the first two lines of code first instantiate and then initialize the driver. The sequence of actions that occurs during this initialization process is discussed in the topic Customizing Driver Intialization. After the client application is finished using the driver, a call to IIviDriver::Close triggers the shutdown sequence that is detailed in the table below:

Step

Function Called

Description

1

driver.Close() runs

2

IIviDriver::Close()

This method executes on the main driver class after each client call to the Close method.

3

CloseIO

By default, Nimbus closes the selected I/O provider (typically the VISA-COM or VISA-C I/O provider). Drivers using a custom I/O library would override this method to perform custom I/O shutdown and to release any custom I/O resources.

4

OnFinalClose

This method executes on the main driver class and on the repeated capability classes. The OnFinalClose method is called on the repeated capabilities before it is called on the main driver class.

5

OnFinalRelease

This method executes only on the main driver class. This method is called only once on the main driver class over the lifetime of the driver instance, irrespective of the number of times the client application invokes the driver's Close method.

6

Main driver class destructor

This code is tightly integrated into the ATL plumbing and is never directly modified in a driver.

Download a complete CHM version of this documentation here.