⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cxtrmv.c

📁 CMEX source code RTOS for atmel atmega128
💻 C
字号:
/*********************************************************

Copyright (c) CMX Company. 1999. All rights reserved

*********************************************************/
/* version 5.30 */

#define CMXMODULE 1

#include <cxfuncs.h>	/* get cmx include header file */
#include <cxextern.h>	/* get cmx include header file */

#ifdef CMXTRACKER
#include <cmxtrack.h>	/* get cmx include header file */
#endif

/***********************************************************
 Remove a task. Once removed this task can not be used in anyway
 Also the task MUST NOT be waiting on anything, foe it will not
 be removed if so.
***********************************************************/
byte K_Task_Delete(byte tskid)
{
	tcbpointer tcbptr;

	if(K_I_Get_Ptr(tskid,&tcbptr))	/* send address of pointer */
		{
#ifdef CMXTRACKER
		if (CMXTRACKER_ON)
			{
			cmxtracker_in2(CXTRMV_K_ERROR,tskid);
			}
#endif
		return(K_ERROR);
		}
	K_I_Disable_Sched();	/* set task block */
	if (tcbptr->tcbstate & ANY_WAIT)	/* see if task waiting */
		{
#ifdef CMXTRACKER
		if (CMXTRACKER_ON)
			{
			cmxtracker_in2(CXTRMV_WAIT_K_ERROR,tskid);
			}
#endif
		K_I_Func_Return();	/* task was waiting, cannot terminate this task */
		return(K_ERROR);	/* return error status, task was not terminated */
		}
	else
		{
		K_I_Unlink(tcbptr);	/* no, task not waiting. Remove task from TCB */
		if (tcbptr == activetcb)	/* is task trying to commit suicide */
			{
			activetcb->tcbstate = 0;	/* load in highest priority task */
			PREEMPTED;	/* set the preempted scheduling flag */
			}
		}
#ifdef CMXTRACKER
		if (CMXTRACKER_ON)
			{
			cmxtracker_in2(CXTRMV_K_OK,tskid);
			}
#endif
	K_I_Func_Return();	/* release task block */
	return(K_OK);	/* return good status, if task not committing suicide */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -