This method cleans up the memory after a RiCOSTask object is deleted.
void RiCOSTask_cleanup (RiCOSTask *const me);
me
The RiCOSTask object to clean up after
void RiCOSTask_cleanup(RiCOSTask * const me)
{
if (me == NULL) return;
if (!me->isWrapperThread) {
RiCOSEventFlag_cleanup(&me->m_SuspEventFlag);
/* Remove the thread. */
if (me->endOSTaskInCleanup) {
RiCBoolean onMyTask = RiCOSTask_exeOnMyTask(me);
if (!((RiCOSTask_endOfProcess) &&
RiCOSTask_exeOnMyTask(me))) {
/* Do not kill the OS thread if this is the
end of process and the running thread
is 'this' - you need the OS thread to do
some cleanup, and then you kill it
explicitly. */
RiCOSTaskEndCallBack theOSTaskEndClb = NULL;
void * arg1 = NULL;
/* Get a callback function to end the OS
thread. */
(void)RiCOSTask_getTaskEndClbk(me,
&theOSTaskEndClb, &arg1, onMyTask);
if (theOSTaskEndClb != NULL) {
/* End the OS thread */
(*theOSTaskEndClb)(arg1);
}
}
}
}
}