当前位置: 首页 > wzjs >正文

医疗网站咨询源码北京发布重磅消息

医疗网站咨询源码,北京发布重磅消息,鄞州seo整站优化服务,网络维护工具一 接收到互斥量时,将互斥量的任务持有者赋值为当前任务 以下为xQueueGenericReceive()函数接收互斥量,互斥量不为空(未被别的任务持有),去除互斥量,并且将互斥量的持有者赋值为当前任务,紫色字…

  一 接收到互斥量时,将互斥量的任务持有者赋值为当前任务

以下为xQueueGenericReceive()函数接收互斥量,互斥量不为空(未被别的任务持有),去除互斥量,并且将互斥量的持有者赋值为当前任务,紫色字体部分

if( uxMessagesWaiting > ( UBaseType_t ) 0 )
            {
                /* Remember the read position in case the queue is only being
                peeked. */
                pcOriginalReadPosition = pxQueue->u.pcReadFrom;

                prvCopyDataFromQueue( pxQueue, pvBuffer );

                if( xJustPeeking == pdFALSE )
                {
                    traceQUEUE_RECEIVE( pxQueue );

                    /* Actually removing data, not just peeking. */
                    pxQueue->uxMessagesWaiting = uxMessagesWaiting - 1;

                    #if ( configUSE_MUTEXES == 1 )
                    {
                        if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
                        {
                            /* Record the information required to implement
                            priority inheritance should it become necessary. */
           pxQueue->pxMutexHolder = ( int8_t * ) pvTaskIncrementMutexHeldCount(); /*lint !e961 Cast is not redundant as TaskHandle_t is a typedef. */
                        }
                        else
                        {
                            mtCOVERAGE_TEST_MARKER();
                        }
                    }
                    #endif /* configUSE_MUTEXES */

二 接收任务接收不到信号量时,提升互斥量持有者任务的优先级

还是xQueueGenericReceive()函数接收互斥量,互斥量为空(被别的任务持有),而且时间未超时时,就是第一次尝试接收时,进行优先级继承,紫色字体函数

 /* Update the timeout state to see if it has expired yet. */
        if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )
        {
            if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
            {
                traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue );

                #if ( configUSE_MUTEXES == 1 )
                {
                    if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
                    {
                        taskENTER_CRITICAL();
                        {
                            vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );
                        }
                        taskEXIT_CRITICAL();
                    }
                    else
                    {
                        mtCOVERAGE_TEST_MARKER();
                    }
                }
                #endif

                vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
                prvUnlockQueue( pxQueue );
                if( xTaskResumeAll() == pdFALSE )
                {
                    portYIELD_WITHIN_API();
                }
                else
                {
                    mtCOVERAGE_TEST_MARKER();
                }
            }

三 最终实现函数TaskPriorityInherit()解析

void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder )
    {
    TCB_t * const pxTCB = ( TCB_t * ) pxMutexHolder;

       
        if( pxMutexHolder != NULL )
        {
            
            if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
            {
                   /* Adjust the mutex holder state to account for its new
                priority.  Only reset the event list item value if the value is
                not    being used for anything else. */
                if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL ) //获取互斥量持有任务的节点辅助值,用于迁移到新优先级就绪链表时的排序
                {
                    listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority ); //设定互斥量持有任务的节点辅助值,用于迁移到新优先级就绪链表时的排序
                }
                else
                {
                    mtCOVERAGE_TEST_MARKER();
                }

                /* If the task being modified is in the ready state it will need
                to be moved into a new list. */
                if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xStateListItem ) ) != pdFALSE )//互斥量持有者任务现在处于就绪列表
                {
                    if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )//将互斥量持有者任务从其所在就绪列表移除
                    {
                        taskRESET_READY_PRIORITY( pxTCB->uxPriority );
                    }
                    else
                    {
                        mtCOVERAGE_TEST_MARKER();
                    }

                    /* Inherit the priority before being moved into the new list. */
                    pxTCB->uxPriority = pxCurrentTCB->uxPriority;//将互斥量持有者任务优先级赋值为当前任务优先级
                    prvAddTaskToReadyList( pxTCB );//将互斥量持有者任务移到相应优先级列表
                }
                else
                {
                    /* Just inherit the priority. */
                    pxTCB->uxPriority = pxCurrentTCB->uxPriority;  //将互斥量持有者任务优先级赋值为当前任务优先级,只进行优先级上升级,因为现在不在就绪列表中
                }

                traceTASK_PRIORITY_INHERIT( pxTCB, pxCurrentTCB->uxPriority );
            }
            else
            {
                mtCOVERAGE_TEST_MARKER();
            }
        }
        else
        {
            mtCOVERAGE_TEST_MARKER();
        }
    }
 


文章转载自:

http://jUxkcBLx.tsgxz.cn
http://hX6wGQdj.tsgxz.cn
http://3zalTprE.tsgxz.cn
http://tNCiVlTT.tsgxz.cn
http://VLzcFFQ1.tsgxz.cn
http://0vGOyRwR.tsgxz.cn
http://3EiBHdLn.tsgxz.cn
http://zezOPIWE.tsgxz.cn
http://xQ65AWcX.tsgxz.cn
http://ydPHL0zv.tsgxz.cn
http://4NpAgXRd.tsgxz.cn
http://f1J15Jd7.tsgxz.cn
http://JgsLmBha.tsgxz.cn
http://zgEqDbzv.tsgxz.cn
http://nSoUAdde.tsgxz.cn
http://RPqNxISr.tsgxz.cn
http://B4F3Wk7W.tsgxz.cn
http://7JE5EgXf.tsgxz.cn
http://cOIJo2Cq.tsgxz.cn
http://Pb6SHUWf.tsgxz.cn
http://hN3ihhUF.tsgxz.cn
http://ClyjmtBH.tsgxz.cn
http://8qpiEWer.tsgxz.cn
http://01WVEv0y.tsgxz.cn
http://nOwpdL7q.tsgxz.cn
http://ePOGQXUM.tsgxz.cn
http://usGczd3p.tsgxz.cn
http://VZZpBANP.tsgxz.cn
http://VlByK7bA.tsgxz.cn
http://ka6PLGzt.tsgxz.cn
http://www.dtcms.com/wzjs/728597.html

相关文章:

  • 垫江网站建设做网站需要什么学历
  • 龙华区城市建设局网站seo运营招聘
  • 厦门找一家做网站的公司陈家镇建设发展公司网站
  • 聊城做wap网站服务招聘网站企业招聘怎么做
  • 网站弹广告是什么样做的企业公司建站平台
  • 个人简历网页制作教程百度推广优化
  • 门户网站集约化建设深圳龙华新区住房和建设局网站
  • 南宁做棋牌网站的公司重庆经典论坛新闻评论
  • 房地产网站做百度推广网站建设报告内容
  • 周到的宁波网站建设中信建设有限责任公司总部在哪
  • 哈尔滨网站制作哪儿好薇一个人做两个博客网站
  • 手机网站建设yu免费的seo网站
  • 网站代理备案表怎么做网站优化排名
  • 对网站建设的意见建议江都建设网站
  • 2018网站建设高考成绩查询网站维护与建设ppt
  • 佛山网站建设业务员多用户网站建设方案
  • 洛阳微信网站建设定制衣服
  • 网站建设收费标准讯息qq刷赞网站咋做
  • 怎样做京东网站免费做情网站
  • 海南做网站找谁自己做网站用什么app
  • 我被钓鱼网站骗了骗取建设信用卡建设银行会怎么处理钱会还回吗网站开发常用图标 图像
  • 金华哪里做网站设计北京
  • 车票在线制作网站wordpress系列文章
  • 怎么做找券网站网页设计页面配色分析
  • 加快网站平台建设app推广注册赚钱
  • 制作网站问题和解决方法万网域名注册商
  • 交换链接适用于哪些网站网站建设价格标准报价
  • 高埗东莞网站建设上海网站建设公司怎么样
  • 哪个网站可以建设网站《php网站开发》课程资料
  • 做网站翻页怎么做私募网站建设