FreeRTOS源码解析 -> vTaskResume()

本文深入探讨FreeRTOS操作系统中的vTaskResume()函数,详细解析其内部实现逻辑,包括任务状态转换、调度器调用等关键步骤,帮助读者理解FreeRTOS的任务管理机制。
摘要由CSDN通过智能技术生成


#if ( INCLUDE_vTaskSuspend == 1 )

	void vTaskResume( xTaskHandle pxTaskToResume )
	{
	    tskTCB *pxTCB;

		/* It does not make sense to resume the calling task. */
		configASSERT( pxTaskToResume );

		/* Remove the task from whichever list it is currently in, and place
		it in the ready list. */
		pxTCB = ( tskTCB * ) pxTaskToResume;

		/* The parameter cannot be NULL as it is impossible to resume the
		currently executing task. */
		//要恢复的task不为空并且不是当前正在运行的task(如果是当前运行的还恢复个毛线)
		//熟悉的链表操作啊
		if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) )
		{	
			//进入临界区
			taskENTER_CRITICAL();
			{
				//判断要恢复的task是否在挂起列表中
				if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )
				{
					traceTASK_RESUME( pxTCB );

					/* As we are in a critical section we can access the ready
					lists even if the scheduler is suspended. */
					//从挂起链表中删除,加入到ready队列中(恢复到就绪态)
					v
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值