| |||
Home > The Target Connection Mechanism > Disconnecting from a target |
The target connection mechanism in CADI enables establishing connections to CADI targets. It is also responsible for a clean disconnection from targets and the release of a connected simulation object.
The primary way to disconnect from a simulation is to use
the Release()
method of those target-side classes
which are involved in the connection mechanism. After this method
is called, the caller must ensure that it does not start any additional
interaction with the connection. The call performs the appropriate
actions on the target-side such as:
informing other connected callers
if the simulation is to be shut down, destroying objects that are no longer used.
The caller must not explicitly destroy any target-side objects.
This is the task of the target implementation and must be triggered
through Release()
calls wherever appropriate.
Using only Release()
calls is acceptable
for simple scenarios such as unique and direct connections between
caller and target. For more sophisticated scenarios, however, a well-coordinated
disconnection is required. The CADISimulationCallback
class
provides two callbacks that are essential for such a disconnection:
simShutdown()
the simulation signals a request for a clean shutdown.
simKilled()
the simulation signals a hard shutdown. It was not able to
be kept alive until a clean shutdown could be performed. After this
call is received, the caller must ensure that it does not access
the CADISimulation
or associated CADI
objects.
Using these callbacks in combination with the Release()
method
in the target enables establishing well-defined procedures for disconnection
from a CADI simulation.