此方法會在刪除 RiCOSTimer 物件之後,清除記憶體。
void RiCOSTimer_cleanup (RiCOSTimer * const me);
me
The RiCOSTimer object to clean up after
void RiCOSTimer_cleanup(RiCOSTimer * const me)
{
if (me == NULL) return;
if (me->hThread) {
RiCOSHandle executedOsHandle =
RiCOSTask_getCurrentTaskHandle();
/* A handle to this 'thread' */
RiCOSHandle myOsHandle = me->hThread;
RiCBoolean onMyThread = ((executedOsHandle ==
myOsHandle) ? TRUE : FALSE);
if (onMyThread) {
RiCOSTask_endMyTask((void*)myOsHandle);
}
else {
RiCOSTask_endOtherTask((void*)myOsHandle);
}
me->hThread = 0;
}
}