Blueprint Help Send comments on this topic.
ClpRetireThisProcess

Glossary Item Box

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.

NB. Calling ClpRetireThisProcess() from a Master process is equivalent to calling ClpExit(). However, ClpExit()'s intention is more explicit and should therefore be used in preference.

Generation

The ClpRetireThisProcess function initiates the process shutdown and returns.

Uns ClpRetireThisProcess();

Return

This function will return TRUE if successful, or FALSE otherwise.

Examples

Uns CAppDialog::OnClickedBnExit()
{
   Uns success = FALSE;

   if ( ClpAmMaster() )
      success = ClpExit( "Application Exit Called" );
   else
   {
      ClpDiag( "Slave %d retiring\n", ClpThisSlaveId() );
      success = ClpRetireThisProcess();
   }

   return success;
}