Description
Due to the distributed nature of CLiP applications they must be shut down in a precise asynchronous order.
When a Application or Master is Terminated.
Slaved methods need to be terminated.
Slave processes need to be terminated.
Sub Masters threads need to be terminated.
Sub Masters need to be terminated.
Root Masters threads need to be terminated.
Devices need to be terminated.
Root Master needs to be terminated.
GUI application needs to be terminated.
When a Sub-Master is terminated
Sub-Master needs to deregister from its Master.
Slave methods need to be terminated.
Slave processes need to be terminated.
Sub Masters threads need to be terminated.
Sub Masters need to be terminated.
Sub-Master devices need to be terminated.
Master needs to be informed of termination
When a Slave is terminated
Slave needs to deregister from its Master/Sub-Master.
Slave methods need to be terminated.
Slave processes need to be terminated.
Master/Sub-Master to be informed of termination.
To simplify this process CLIP provides two functions one to shut down everything ClpExit and another to shutdown a Slave (or a SubMaster and its Slaves) ClpRetireThisProcess.
These function can be called from anywhere.
Generation
The ClpExit function initiates the application shutdown and returns.
Uns ClpExit( char *msg );
msg
String to be passed to the system on shutdown.
Return
This function will return TRUE if successful, or FALSE otherwise.
Examples
Uns AppCct_CriticalMthdElem::Process()
{
Uns success = FALSE;
Uns elemNum = this->ElemNum();
ClpDiag( "Critical Method %d: Processing\n", elemNum );
success = DoCriticalStuff();
if ( ! success )
ClpExit( "Critical Method FAILED" );
else
ClpDiag( "Critical Method %d: Done\n" );
return success;
}