RiCOSEndApplication

이 메소드는 실행 중인 애플리케이션을 종료합니다. 이러한 오퍼레이션은 대상 운영 체제의 구체적 어댑터에서 구현됩니다.

시그니처
extern void RiCOSEndApplication (int errorCode);
매개변수
errorCode

필요한 경우 운영 체제로 전달되는 오류 코드를 지정합니다.

예제
void RiCOSEndApplication(int errorCode)
{
   RiCTask* currentThread, *maint;
   RiCOSTask_endOfProcess = 1;   

   #ifdef _OMINSTRUMENT
      ARCSD_instance();
      ARCSD_closeConnection();
   #endif   

   currentThread = RiCTask_cleanupAllTasks();   

   #ifdef _OMINSTRUMENT
      ARCSD_Destroy();
   #endif   
   
   RiCTimerManager_cleanup(&RiCSystemTimer);
   maint = RiCMainTask();

   if (maint) {

      RiCOSHandle maintHandle = RiCOSTask_getOSHandle(
         RiCTask_getOSTask(maint));
      char * maintName = taskName(maintHandle);
      int killmainthread = 1;

      if (maintName && *maintName) {
         if (!strcmp(maintName,"tShell")) 
            taskRestart(maintHandle);         
         else
            taskDeleteForce(maintHandle);
            killmainthread = 0;
         }

      if (killmainthread) {
         RiCTask_destroy(maint);
      }
   }

   if (currentThread) {
      RiCOSTaskEndCallBack theOSThreadEnderClb;
      void * arg1;

      /* Get a callback to end the thread. */
      (void)RiCTask_getTaskEndClbk(
         currentThread, &theOSThreadEnderClb,
         &arg1,RiCTRUE);
      RiCOSTask_setEndOSTaskInCleanup(
         RiCTask_getOSTask(currentThread), FALSE);
      /* Do not really end the os thread because you 
         are executing on this thread and if you do,
         there will be a resource leak. */
      RiCTask_destroy(currentThread);
      /* Delete the whole object through a virtual 
            destructor. */
      if (theOSThreadEnderClb != NULL) {
         (*theOSThreadEnderClb)(arg1);   
         /* Now end the os thread. */
      }
   }
   /* Make sure that the execution thread is being 
      ended. */
   RiCOSTask_endMyTask((void *) taskIdSelf());
}

피드백