📄 zappendtoresourcequeue.c
字号:
/*
* File : ZAppendToResourceQueue.c
*
* Description : This file defines AppendToResourceQueue routine
*
* Copyright 2004 ZiLOG Inc. ALL RIGHTS RESERVED.
*
* This file contains unpublished confidential and proprietary information
* of ZiLOG, Inc.
* NO PART OF THIS WORK MAY BE DUPLICATED, STORED, PUBLISHED OR DISCLOSED
* IN ANY FORM WITHOUT THE PRIOR WRITTEN CONSENT OF ZiLOG, INC.
* This is not a license and no use of any kind of this work is authorized
* in the absence of a written license granted by ZiLOG, Inc. in ZiLOG's
* sole discretion
*/
#include "ZSysgen.h"
#include "ZTypes.h"
#include "ZThread.h"
#include "ZQueue.h"
#include "ZMessageQ.h"
#define pThread ((RZK_TCB_t *)hThread)
#define pObject ((RZK_MESSAGEQUEUE_t *) hObject)
/** extern functions */
extern void AddToResourceQueueBeg( RZK_HANDLE_t hInsertionPos,RZK_THREADHANDLE_t hThread);
extern void AddToResourceQueue( RZK_HANDLE_t hInsertionPos,RZK_THREADHANDLE_t hThread);
/* Function : AppendToResourceQueue
*
* Description : Adds a given thread to the resource queue.
*
* Inputs : hObject-Specifies a given handle.
* hThread-Thread handle
* Outputs : void.
*
*
* Dependencies : None.
*/
void AppendToResourceQueue(RZK_HANDLE_t hObject,RZK_THREADHANDLE_t hThread)
{
RZK_TCB_t *pTemp,*pInsert;
/* Adds a given thread to resource queue based on whther it's a priority/FIFO queue */
if (pObject->uState & OBJECT_RECV_PRIORITY)/*PRIORITY*/
{
pInsert = ( RZK_TCB_t * ) NULL;
pTemp = ( RZK_TCB_t * ) pObject->pResNext;
while(pTemp != NULL)
{
if( pThread->cDispPriority < pTemp->cDispPriority)
break;
pTemp = (pInsert = pTemp)->pResNext;
}
}
else/*FIFO*/
{
pTemp = ( RZK_TCB_t * ) NULL;
pInsert = ( RZK_TCB_t * ) pObject->pLastPosition;
}
if(pTemp == NULL)
pObject->pLastPosition = pThread;
else
pTemp->pResPrevious = pThread;
/* Add to Resource queue beginning/end based on queue contents */
if(pInsert == NULL)
AddToResourceQueueBeg(pObject,hThread);
else
AddToResourceQueue(pInsert,hThread);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -