/***************************************************************************** Function : VOS_SuspendTask Description: Suspend a task Calls : OSAL_SuspendTask Called By : Input : ulTaskID -- id of a task Output : none Return : return VOS_OK if success Other : none *****************************************************************************/ VOS_UINT32 VOS_SuspendTask( VOS_UINT32 ulTaskID ) { if( ulTaskID >= vos_TaskCtrlBlkNumber ) { return(VOS_ERR); } if ( NU_SUCCESS != NU_Suspend_Task( &(vos_TaskCtrlBlk[ulTaskID].NuTid) ) ) { Print("# Nucleus taskSuspend error.\r\n"); return(VOS_ERR); } return(VOS_OK); }
static void gc_thread(unsigned long a, void *b) { while (1) { /* wait for operations on queue */ while(gc_queue.busy) NU_Sleep(40); /* block queue */ gc_queue.busy = 1; /* getting first item */ GCQueueItem *i = gc_queue.first; /* if we have it... */ if(i) { /* ... set the next item as first */ gc_queue.first = i->next; /* if it`s last item, so ... */ if(!gc_queue.first) gc_queue.last = 0; } else { gc_queue.last = 0; } /* unblock queue */ gc_queue.busy = 0; if(i) { NU_Sleep(i->delay); fwlib->free(i->body); fwlib->free(i); /* we go to the next item */ continue; } else NU_Suspend_Task(&gc_tsk); } }
void __gc_destroy() { NU_Suspend_Task(&gc_tsk); NU_Terminate_Task(&gc_tsk); NU_Delete_Task(&gc_tsk); }