getTaskEndClbk

This method is a callback function that ends the current operating system thread.

Signature
int RiCOSTask_getTaskEndClbk (RiCOSTask * const me,
   RiCOSTaskEndCallBack * clb_p, void ** arg1_p,
   RiCBoolean onExecuteTask);
Parameters
me

The RiCOSTask object.

clb_p

A pointer to the callback function that ends the thread. This can be either endMyTask() or endOtherTask().

arg1_p

The argument for the callback function.

onExecuteTask

Set this to one of the following Boolean values:

RiCTRUE—The object should kill its own task.
RiCFALSE—Another object should kill the task.
Returns

The status. The possible values are as follows:

Example
int RiCOSTask_getTaskEndClbk(RiCOSTask * const me,
   RiCOSTaskEndCallBack * clb_p,
   void ** arg1_p, RiCBoolean onExecuteTask)
{
   if (me == NULL) return 0;

   if (onExecuteTask) {
      /* Ask for a callback to end my own thread. */
      *clb_p = (RiCOSTaskEndCallBack)&
         RiCOSTask_endMyTask;
      *arg1_p = (void*)me->hThread;
   }
   else {
      /* Ask for a callback to end my thread by
         someone else. */
      *clb_p  = (RiCOSTaskEndCallBack)&
         RiCOSTask_endOtherTask;
      /* My thread handle. */
      *arg1_p = (void*)me->hThread;
   }
   return 1;
}

Feedback