2.7.4 Typical shutdown scenarios

This section describes the typical scenarios for shutting down a simulation.

Single caller and the caller initiates shutdown

A single connected caller initiating a simulation shutdown is the most typical scenario.

The procedure consists of a Release() call to the simulation with either true or false as the shutdown parameter value. Depending on the parameter value, the simulation is destroyed or kept alive.
Figure 2-10 Single caller and simulation shutdown initiated by caller
To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

Single caller and the simulation initiates shutdown

The simulation initiates its shutdown and informs the caller.

This scenario is used, for example, if the simulation offers a user-interface for interaction that permits ending the simulation. The procedure requires two steps:
  1. The simulation that is shutting down, for example because of a corresponding semihosting input, issues a simShutdown() callback through the registered simulation callback object.
  2. The first reaction of the attached caller is to unregister any callback object that is registered to targets owned by the simulation.
  3. After unregistering the callbacks, the caller issues a Release() call to indicate that it does not access the simulation or targets in the future.
Figure 2-11 Single caller and simulation shutdown initiated by simulation
To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

The shutdown parameter can be set to false, as the simulation is already shutting down. A value of true is ignored at this point.

Multiple callers and one of the callers initiates shutdown

The sequence is similar to that for a single caller that initiates shutdown except that the other caller must also be shut down.

Figure 2-12 Simulation shutdown initiated by caller while multiple callers are attached
To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

  1. Call the Release() method for the simulation. The shutdown parameter can be either true or false. If false, the simulation is not shut down and the sequence ends here.
  2. If shutdown is true, there is a requirement for some interaction with all other attached callers. To indicate the demand to shut down, the simulation issues the simShutdown() callback to all registered simulation callback objects that are enabled for this call.
  3. The informed callers must stop their communication with the simulation as soon as possible and remove any registered callback objects from the simulation and its targets.
    The affected callers must sign off with a Release() call to announce successful disconnection from the simulation. Its shutdown parameter is set to false as the shutdown is already in progress (a value of true is ignored at this point).
  4. After all callers have disconnected from the simulation, the CADISimulation object can be destroyed.
  5. If all callers have not disconnected, but the simulation must urgently shut down, the simulation sends a simKilled() callback. If this occurs, the caller must not access the corresponding simulation in the future.

Multiple callers and the simulation initiates shutdown

Multiple callers are attached to a simulation and the simulation initiates its own shutdown.

This scenario is used, for example, if the simulation offers a user-interface for interaction that permits ending the simulation:
Figure 2-13 Multiple callers and simulation shutdown initiated by simulation
To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

The main difference between this situation and one in which there are multiple callers and one of the callers initiates shutdown is the missing Release(true) call:
  1. The simulation immediately issues the simShutdown() callbacks to all attached callers that have registered a simulation callback object.
  2. Each informed caller must perform a call to Release(). After all attached callers are signed off, the simulation can be safely destroyed.
Non-ConfidentialPDF file icon PDF versionARM DUI0842F
Copyright © 2014, 2015 ARM. All rights reserved.