FreeRTOS的列表和列表项

列表和列表项

列表

列表是FreeRTOS中的一个数据结构,概念上和链表有点类型,是一个循环双向链表,列表被用来跟踪FreeRTOS中的任务。列表的类型是List_T,具体定义如下:

typedef struct xLIST
{listFIRST_LIST_INTEGRITY_CHECK_VALUE				/*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */configLIST_VOLATILE UBaseType_t uxNumberOfItems;ListItem_t * configLIST_VOLATILE pxIndex;			/*< Used to walk through the list.  Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */MiniListItem_t xListEnd;							/*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */listSECOND_LIST_INTEGRITY_CHECK_VALUE				/*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
} List_t;
  • listFIRST_LIST_INTEGRITY_CHECK_VALUE和listSECOND_LIST_INTEGRITY_CHECK_VALUE都是用来检查列表完整性的,需要将宏configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 设置为1,默认不开启。
  • uxNumberOfItems:记录列表项的数量
  • pxIndex:指向当前的列表项,可用来遍历列表,类型是ListItem_t *
  • xListEnd:作为一个标记,表示列表最后一个列表项,类型是MiniListItem_t 。
列表项

FreeRTOS提供了两种列表项:列表项(ListItem_t 类型)和迷你列表项(MiniListItem_t 类型)。对于列表项,具体定义为:

struct xLIST_ITEM
{listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE			/*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */configLIST_VOLATILE TickType_t xItemValue;			/*< The value being listed.  In most cases this is used to sort the list in descending order. */struct xLIST_ITEM * configLIST_VOLATILE pxNext;		/*< Pointer to the next ListItem_t in the list. */struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;	/*< Pointer to the previous ListItem_t in the list. */void * pvOwner;										/*< Pointer to the object (normally a TCB) that contains the list item.  There is therefore a two way link between the object containing the list item and the list item itself. */void * configLIST_VOLATILE pvContainer;				/*< Pointer to the list in which this list item is placed (if any). */listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE			/*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
};
typedef struct xLIST_ITEM ListItem_t;					/* For some reason lint wants this as two separate definitions. */
  • listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE和listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE检查列表项完整性
  • xItemValue:列表项的值
  • pxNext:指向下一个列表项
  • pxPrevious:指向前一个列表项
  • pvOwner:记录此列表项归谁拥有,通常是任务控制块
  • pvContainer:记录该列表项归哪个列表

迷你列表项:

struct xMINI_LIST_ITEM
{listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE			/*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */configLIST_VOLATILE TickType_t xItemValue;struct xLIST_ITEM * configLIST_VOLATILE pxNext;struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
};
typedef struct xMINI_LIST_ITEM MiniListItem_t;

可以看出迷你列表项只是比列表项少了几个成员变量,迷你列表项所有的成员变量列表项都有。
对于列表结构体List_t中的xListEnd是MiniListItem_t类型,表示最后一个列表项,pxIndex是ListItem_t指针类型,指向真正有数据的列表项。

列表和列表项初始化

列表初始化

新创建的或者定义的列表需要对其做初始化处理,列表初始化其实就是初始化列表结构体List_t中的各个成员变量,列表的初始化通过函数vListInitialise()来完成。

void vListInitialise( List_t * const pxList )
{/* The list structure contains a list item which is used to mark theend of the list.  To initialise the list the list end is insertedas the only list entry. */pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd );			/*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. *//* The list end value is the highest possible value in the list toensure it remains at the end of the list. */pxList->xListEnd.xItemValue = portMAX_DELAY;/* The list end next and previous pointers point to itself so we knowwhen the list is empty. */pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd );	/*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */pxList->uxNumberOfItems = ( UBaseType_t ) 0U;/* Write known values into the list ifconfigUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
}

函数的参数是一个列表

  • pxIndex 指向强制类型转换的xListEnd
  • xItemValue 列表项的值为portMAX_DELAY
    在这里插入图片描述
  • pxNext :指向自己
  • pxPrevious :指向自己
  • uxNumberOfItems :列表中的列表项数目为0

下图为初始化后的列表
在这里插入图片描述

列表项初始化
void vListInitialiseItem( ListItem_t * const pxItem )
{/* Make sure the list item is not recorded as being on a list. */pxItem->pvContainer = NULL;/* Write known values into the list item ifconfigUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
}

函数的参数是一个列表项指针,只是将列表项的pvContainer初始化为NULL
下图为列表项初始后的列表项
在这里插入图片描述

列表项插入

列表项插入相当于和在循环双向链表中按照数值的递增插入数据原理是一样的。
列表项的插入式通过函数vListInsert来完成的

void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )

参数:

  • pxList:要插入的列表
  • pxNewListItem :要插入的列表项
    vListInsert是根据pxNewListItem 中的成员变量xItemValue的值来决定插入位置。根据xItemValue的升序方式排序。

具体插入过程如下:

void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
{
ListItem_t *pxIterator;
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;/* Only effective when configASSERT() is also defined, these tests may catchthe list data structures being overwritten in memory.  They will not catchdata errors caused by incorrect configuration or use of FreeRTOS. */listTEST_LIST_INTEGRITY( pxList );listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );/* Insert the new list item into the list, sorted in xItemValue order.If the list already contains a list item with the same item value then thenew list item should be placed after it.  This ensures that TCB's which arestored in ready lists (all of which have the same xItemValue value) get ashare of the CPU.  However, if the xItemValue is the same as the back markerthe iteration loop below will not end.  Therefore the value is checkedfirst, and the algorithm slightly modified if necessary. */if( xValueOfInsertion == portMAX_DELAY ){pxIterator = pxList->xListEnd.pxPrevious;}else{/* *** NOTE ***********************************************************If you find your application is crashing here then likely causes arelisted below.  In addition see http://www.freertos.org/FAQHelp.html formore tips, and ensure configASSERT() is defined!http://www.freertos.org/a00110.html#configASSERT1) Stack overflow -see http://www.freertos.org/Stacks-and-stack-overflow-checking.html2) Incorrect interrupt priority assignment, especially on Cortex-Mparts where numerically high priority values denote low actualinterrupt priorities, which can seem counter intuitive.  Seehttp://www.freertos.org/RTOS-Cortex-M3-M4.html and the definitionof configMAX_SYSCALL_INTERRUPT_PRIORITY onhttp://www.freertos.org/a00110.html3) Calling an API function from within a critical section or whenthe scheduler is suspended, or calling an API function that doesnot end in "FromISR" from an interrupt.4) Using a queue or semaphore before it has been initialised orbefore the scheduler has been started (are interrupts firingbefore vTaskStartScheduler() has been called?).**********************************************************************/for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */{/* There is nothing to do here, just iterating to the wantedinsertion position. */}}pxNewListItem->pxNext = pxIterator->pxNext;pxNewListItem->pxNext->pxPrevious = pxNewListItem;pxNewListItem->pxPrevious = pxIterator;pxIterator->pxNext = pxNewListItem;/* Remember which list the item is in.  This allows fast removal of theitem later. */pxNewListItem->pvContainer = ( void * ) pxList;( pxList->uxNumberOfItems )++;
}
  1. 获取pxNewListItem的xItemValue值
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
  1. 检查列表和列表项的完整性
	listTEST_LIST_INTEGRITY( pxList );listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
  1. 判断插入的位置,如果等于portMAX_DELAY ,列表项的最大值,插入的位置是列表最末尾
	if( xValueOfInsertion == portMAX_DELAY ){pxIterator = pxList->xListEnd.pxPrevious;}
  1. 不等于portMAX_DELAY ,则for循环找到插入位置,这个查找过程是按照升序的方式查找列表项插入点的,列表的xListEnd 可以想成链表的头,不放数据,方便查询用的,xListEnd 指向的列表项的xItemValue 值最小
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) 
  1. 将列表项插入到列表中
	pxNewListItem->pxNext = pxIterator->pxNext;pxNewListItem->pxNext->pxPrevious = pxNewListItem;pxNewListItem->pxPrevious = pxIterator;pxIterator->pxNext = pxNewListItem;/* Remember which list the item is in.  This allows fast removal of theitem later. */pxNewListItem->pvContainer = ( void * ) pxList;
  1. 列表的列表项数目加1
	( pxList->uxNumberOfItems )++;
列表项插入过程

一个初始化的空列表如下:
在这里插入图片描述
插入值为40的列表项后
在这里插入图片描述

插入值60的列表项
在这里插入图片描述
插入50后的列表项为
在这里插入图片描述

列表末尾插入

末尾插入就不根据xItemValue了,直接插入末端。原理和在循环双向链表的末尾插入数据是一样的

void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )

列表项的删除

UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove );
  • pxItemToRemove :要删除的列表项

列表的遍历

列表结构体中的pxIndex是用来遍历链表的,在说列表项插入的时候,也用到了列表的遍历,具体代码如下:

for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) 

FreeRTOS提供了一个函数来完成列表的遍历,这个函数是listGET_OWNER_OF_NEXT_ENTRY。每调用一次该函数pxIndex变量就会指向下一个列表项,并且返回这个列表项的pxOwner变量值

#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )										\
{																							\
List_t * const pxConstList = ( pxList );													\/* Increment the index to the next item and return the item, ensuring */				\/* we don't return the marker used at the end of the list.  */							\( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;							\if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) )	\{																						\( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;						\}																						\( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;											\
}

pxTCB用来保存pxIndex所指向的列表项pvOwner变量值。pxList是要遍历的列表
将pxIndex指向下一个列表项

( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;

如果指向的列表项是xListEnd ,表示已经到了列表末尾,然后跳过末尾,再一次重新指向列表的第一个列表项。

	if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) )	\{																						\( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;						\}	

将pxIndex所指向的新列表项的pvOwner赋值给pxTCB

	( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;			

列表项的插入和删除实验

实验设计,三个任务:
start_task:创建其他两个任务
task1_task:应用任务1,控制LED0闪烁,用来提示系统正在运行
task2_task:列表和列表项操作任务,调用列表和列表相关的API,并且通过串口输出相应的信息来观察这些API函数的运行过程。

任务设置
#define START_STACK_SIZE 128
#define START_TASK_PIO 1
TaskHandle_t Start_Handler;
void start_task(void * pvParameters);#define TASK1_STACK_SIZE 128
#define TASK1_TASK_PIO 2
TaskHandle_t Task1_Handler;
void task1_task(void * pvParameters);#define TASK2_STACK_SIZE 128
#define TASK2_TASK_PIO 3
TaskHandle_t Task2_Handler;
void task2_task(void * pvParameters);
列表项和列表的定义
//定义一个测试用的列表和是哪个列表项
List_t TestList;
ListItem_t ListItem1;
ListItem_t ListItem2;
ListItem_t ListItem3;
main函数
int main(void)
{HAL_Init();                     //初始化HAL库   Stm32_Clock_Init(360,25,2,8);   //设置时钟,180Mhzdelay_init(180);                //初始化延时函数uart_init(115200);              //初始化串口LED_Init();                     //初始化LED KEY_Init();						//初始化按键SDRAM_Init();					//初始化SDRAMLCD_Init();						//初始化LCDPOINT_COLOR = RED;LCD_ShowString(30,10,200,16,16,"Apollo STM32F4/F7");	LCD_ShowString(30,30,200,16,16,"FreeRTOS Examp 7-1");LCD_ShowString(30,50,200,16,16,"list and listItem");LCD_ShowString(30,70,200,16,16,"ATOM@ALIENTEK");LCD_ShowString(30,90,200,16,16,"2016/10/9");//创建开始任务xTaskCreate(start_task,"start_task",START_STACK_SIZE,NULL,START_TASK_PIO,&Start_Handler);vTaskStartScheduler();
}
任务函数
//开始任务任务函数
void start_task(void * pvParameters)
{taskENTER_CRITICAL();		//进入临界区//创建任务xTaskCreate(task1_task,"task1_task",TASK1_STACK_SIZE,NULL,TASK1_TASK_PIO,&Task1_Handler);xTaskCreate(task2_task,"task1_task",TASK2_STACK_SIZE,NULL,TASK2_TASK_PIO,&Task2_Handler);vTaskDelete(Start_Handler);//退出临界区taskEXIT_CRITICAL();
}//task1任务函数
void task1_task(void * pvParameters)
{while(1){LED0 = !LED0;vTaskDelay(500);}
}
//list任务函数
void task2_task(void * pvParameters)
{//初始化列表和列表项vListInitialise(&TestList);vListInitialiseItem(&ListItem1);vListInitialiseItem(&ListItem2);vListInitialiseItem(&ListItem3);ListItem1.xItemValue=40;ListItem2.xItemValue = 60;ListItem3.xItemValue=50;//第二步:打印列表和其他列表项的地址printf("/*******************列表和列表项地址*******************/\r\n");printf("项目                              地址				    \r\n");printf("TestList                          %#x					\r\n",(int)&TestList);printf("TestList->pxIndex                 %#x					\r\n",(int)TestList.pxIndex);printf("TestList->xListEnd                %#x					\r\n",(int)(&TestList.xListEnd));printf("ListItem1                         %#x					\r\n",(int)&ListItem1);printf("ListItem2                         %#x					\r\n",(int)&ListItem2);printf("ListItem3                         %#x					\r\n",(int)&ListItem3);printf("/************************结束**************************/\r\n");printf("按下KEY_UP键继续!\r\n\r\n\r\n");while(KEY_Scan(0)!=WKUP_PRES) delay_ms(10);	//第三步:向列表TestList添加列表项ListItem1,并通过串口打印所有//列表项中成员变量pxNext和pxPrevious的值,通过这两个值观察列表//项在列表中的连接情况。vListInsert(&TestList,&ListItem1);		//插入列表项ListItem1printf("/******************添加列表项ListItem1*****************/\r\n");printf("项目                              地址				    \r\n");printf("TestList->xListEnd->pxNext        %#x					\r\n",(int)(TestList.xListEnd.pxNext));printf("ListItem1->pxNext                 %#x					\r\n",(int)(ListItem1.pxNext));printf("/*******************前后向连接分割线********************/\r\n");printf("TestList->xListEnd->pxPrevious    %#x					\r\n",(int)(TestList.xListEnd.pxPrevious));printf("ListItem1->pxPrevious             %#x					\r\n",(int)(ListItem1.pxPrevious));printf("/************************结束**************************/\r\n");printf("按下KEY_UP键继续!\r\n\r\n\r\n");while(KEY_Scan(0)!=WKUP_PRES) delay_ms(10);	//第四步:向列表TestList添加列表项ListItem2,并通过串口打印所有//列表项中成员变量pxNext和pxPrevious的值,通过这两个值观察列表//项在列表中的连接情况。vListInsert(&TestList,&ListItem2);	//插入列表项ListItem2printf("/******************添加列表项ListItem2*****************/\r\n");printf("项目                              地址				    \r\n");printf("TestList->xListEnd->pxNext        %#x					\r\n",(int)(TestList.xListEnd.pxNext));printf("ListItem1->pxNext                 %#x					\r\n",(int)(ListItem1.pxNext));printf("ListItem2->pxNext                 %#x					\r\n",(int)(ListItem2.pxNext));printf("/*******************前后向连接分割线********************/\r\n");printf("TestList->xListEnd->pxPrevious    %#x					\r\n",(int)(TestList.xListEnd.pxPrevious));printf("ListItem1->pxPrevious             %#x					\r\n",(int)(ListItem1.pxPrevious));printf("ListItem2->pxPrevious             %#x					\r\n",(int)(ListItem2.pxPrevious));printf("/************************结束**************************/\r\n");printf("按下KEY_UP键继续!\r\n\r\n\r\n");while(KEY_Scan(0)!=WKUP_PRES) delay_ms(10);		//第五步:向列表TestList添加列表项ListItem3,并通过串口打印所有//列表项中成员变量pxNext和pxPrevious的值,通过这两个值观察列表//项在列表中的连接情况。vListInsert(&TestList,&ListItem3);	//插入列表项ListItem3printf("/******************添加列表项ListItem3*****************/\r\n");printf("项目                              地址				    \r\n");printf("TestList->xListEnd->pxNext        %#x					\r\n",(int)(TestList.xListEnd.pxNext));printf("ListItem1->pxNext                 %#x					\r\n",(int)(ListItem1.pxNext));printf("ListItem3->pxNext                 %#x					\r\n",(int)(ListItem3.pxNext));printf("ListItem2->pxNext                 %#x					\r\n",(int)(ListItem2.pxNext));printf("/*******************前后向连接分割线********************/\r\n");printf("TestList->xListEnd->pxPrevious    %#x					\r\n",(int)(TestList.xListEnd.pxPrevious));printf("ListItem1->pxPrevious             %#x					\r\n",(int)(ListItem1.pxPrevious));printf("ListItem3->pxPrevious             %#x					\r\n",(int)(ListItem3.pxPrevious));printf("ListItem2->pxPrevious             %#x					\r\n",(int)(ListItem2.pxPrevious));printf("/************************结束**************************/\r\n");printf("按下KEY_UP键继续!\r\n\r\n\r\n");while(KEY_Scan(0)!=WKUP_PRES) delay_ms(10);	//第六步:删除ListItem2,并通过串口打印所有列表项中成员变量pxNext和//pxPrevious的值,通过这两个值观察列表项在列表中的连接情况。uxListRemove(&ListItem2);						//删除ListItem2printf("/******************删除列表项ListItem2*****************/\r\n");printf("项目                              地址				    \r\n");printf("TestList->xListEnd->pxNext        %#x					\r\n",(int)(TestList.xListEnd.pxNext));printf("ListItem1->pxNext                 %#x					\r\n",(int)(ListItem1.pxNext));printf("ListItem3->pxNext                 %#x					\r\n",(int)(ListItem3.pxNext));printf("/*******************前后向连接分割线********************/\r\n");printf("TestList->xListEnd->pxPrevious    %#x					\r\n",(int)(TestList.xListEnd.pxPrevious));printf("ListItem1->pxPrevious             %#x					\r\n",(int)(ListItem1.pxPrevious));printf("ListItem3->pxPrevious             %#x					\r\n",(int)(ListItem3.pxPrevious));printf("/************************结束**************************/\r\n");printf("按下KEY_UP键继续!\r\n\r\n\r\n");while(KEY_Scan(0)!=WKUP_PRES) delay_ms(10);	//第七步:删除ListItem2,并通过串口打印所有列表项中成员变量pxNext和//pxPrevious的值,通过这两个值观察列表项在列表中的连接情况。TestList.pxIndex=TestList.pxIndex->pxNext;			//pxIndex向后移一项,这样pxIndex就会指向ListItem1。vListInsertEnd(&TestList,&ListItem2);				//列表末尾添加列表项ListItem2printf("/***************在末尾添加列表项ListItem2***************/\r\n");printf("项目                              地址				    \r\n");printf("TestList->pxIndex                 %#x					\r\n",(int)TestList.pxIndex);printf("TestList->xListEnd->pxNext        %#x					\r\n",(int)(TestList.xListEnd.pxNext));printf("ListItem2->pxNext                 %#x					\r\n",(int)(ListItem2.pxNext));printf("ListItem1->pxNext                 %#x					\r\n",(int)(ListItem1.pxNext));printf("ListItem3->pxNext                 %#x					\r\n",(int)(ListItem3.pxNext));printf("/*******************前后向连接分割线********************/\r\n");printf("TestList->xListEnd->pxPrevious    %#x					\r\n",(int)(TestList.xListEnd.pxPrevious));printf("ListItem2->pxPrevious             %#x					\r\n",(int)(ListItem2.pxPrevious));printf("ListItem1->pxPrevious             %#x					\r\n",(int)(ListItem1.pxPrevious));printf("ListItem3->pxPrevious             %#x					\r\n",(int)(ListItem3.pxPrevious));printf("/************************结束**************************/\r\n\r\n\r\n");while(1){LED1=!LED1;vTaskDelay(1000);                           //延时1s,也就是1000个时钟节拍	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/news/379746.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

string基本字符系列容器

二、string基本字符系列容器 简介&#xff1a;C语言只提供了一个char类型来处理字符&#xff0c;而对于字符串&#xff0c;只能通过字符串数组来处理&#xff0c;显得十分不方便。CSTL提供了string基本字符系列容器来处理字符串&#xff0c;可以把string理解为字符串类&#x…

正则表达式(一)

正则表达式概述 1.1什么是正则表达式&#xff1f; 正则表达式(Regular Expression)起源于人类神经系统的早期研究。神经生理学家Warren McCulloch和Walter Pitts研究出一种使用数学方式描述神经网络的方法。1956年&#xff0c;数学家Stephen Kleene发表了一篇标题为“神经…

42.有“舍”才有“得”

大干世界&#xff0c;万种诱惑&#xff0c;什么都想要&#xff0c;会累死你&#xff0c;该放就放&#xff0c;该舍就舍。人必须先有所舍&#xff0c;才能有所得&#xff0c;舍如同种子撒播出去&#xff0c;转了一圈&#xff0c;又带了一大群子子孙孙回来。“舍”永远在“得”的…

Java StringBuilder codePointCount()方法与示例

StringBuilder类codePointCount()方法 (StringBuilder Class codePointCount() method) codePointCount() method is available in java.lang package. codePointCount()方法在java.lang包中可用。 codePointCount() method is used to count the number of Unicode code point…

FreeRTOS时间管理

在使用FreeRTOS的过程中&#xff0c;我们通常会在一个任务函数中使用延时函数对这个任务延时&#xff0c;当执行延时函数的时候就会进行任务切换&#xff0c;并且此任务就会进入阻塞太&#xff0c;直到延时完成&#xff0c;任务重新进入就绪态。延时函数舒属于FreeRTOS的时间管…

set和multiset集合容器

三、①set集合容器 简介&#xff1a;set集合的目的就是为了快速检索。set集合容器实现了红黑树的平衡二叉检索树的数据结构。set集合里面不允许有重复的元素出现&#xff1b;使用set容器前&#xff0c;需要在程序的头文件中声明 #include < set >。 函数方法总结&#…

javascript获取select的值全解

获取显示的汉字 document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text 获取数据库中的id window.document.getElementById("bigclass").value 获取select组分配的索引id window.docume…

Java File类void deleteOnExit()方法(带示例)

文件类void deleteOnExit() (File Class void deleteOnExit()) This method is available in package java.io.File.deleteOnExit(). 软件包java.io.File.deleteOnExit()中提供了此方法。 This method is used to delete the file or directory when the virtual machine termi…

FreeRTOS队列

在实际应用中&#xff0c;我们会遇到一个任务或者中断服务需要和另一个任务进行消息传递&#xff0c;FreeRTOS提供了队列的机制来完成任务与任务、任务与中断之间的消息传递。 0x01 队列简介 队列是为了任务与任务、任务与中断之间的通信而准备的&#xff0c;可以在任务与任务…

括号配对问题(C)

描述 现在&#xff0c;有一行括号序列&#xff0c;请你检查这行括号是否配对。 输入 第一行输入一个数N&#xff08;0<N<100&#xff09;,表示有N组测试数据。后面的N行输入多组输入数据&#xff0c;每组输入数据都是一个字符串S(S的长度小于10000&#xff0c;且S不是空串…

剧情介绍:“阿甘正传”

阿甘是个智商只有75的低能儿。在学校里为了躲避别的孩子的欺侮&#xff0c;听从一个朋友珍妮的话而开始“跑”。他跑着躲避别人的捉弄。在中学时&#xff0c;他为了躲避别人而跑进了一所学校的橄榄球场&#xff0c;就这样跑进了大学。阿甘被破格录取&#xff0c;并成了橄榄球巨…

java 方法 示例_Java集合syncedList()方法与示例

java 方法 示例集合类syncList()方法 (Collections Class synchronizedList() method) synchronizedList() method is available in java.util package. syncList()方法在java.util包中可用。 synchronizedList() method is used to return the synchronized view of the given…

FreeRTOS信号量---二值信号量

信号量可以用来进行资源管理和任务同步&#xff0c;FreeRTOS中信号量又分为二值信号量、计算型信号量、互斥信号量和递归互斥信号量。 0x01 二值信号量 二值信号量其实就是一个只有一个队列项的队列&#xff0c;这个特殊的队列要么是满的&#xff0c;要么是空的&#xff0c;任…

Linux 上 rpm包管理工具的基本使用

查询是否安装某个包&#xff1a;rpm -q 包名查询所有已安装的包&#xff1a;rpm -q a查询未安装包的文件信息&#xff1a;rpm -qilp 未安装的包安装包&#xff1a;rpm -i 包测试安装包&#xff1a;rpm -i test 包删除包&#xff1a;rpm -e 包名测试删除包&#xff1a;rpm -e te…

ios 内存使用陷阱

在iphone开发过程中&#xff0c;代码中的内存泄露我们很容易用内存检测工具leaks 检测出来&#xff0c;并一一改之&#xff0c;但有些是因为ios 的缺陷和用法上的错误&#xff0c;leaks 检测工具并不能检测出来&#xff0c;你只会看到大量的内存被使用&#xff0c;最后收到didR…

FreeRTOS软件定时器

软件定时器允许设置一段时间&#xff0c;当设置的时间达到后就执行指定的功能函数&#xff0c;被软件定时器调用的功能函数叫做定时器的回调函数。软件定时器的回调函数是在定时器服务任务中执行的&#xff0c;所以一定不能在回调函数中调用任何阻塞任务的API函数&#xff0c;比…

Java类class isAssignableFrom()方法及示例

类class isAssignableFrom()方法 (Class class isAssignableFrom() method) isAssignableFrom() method is available in java.lang package. isAssignableFrom()方法在java.lang包中可用。 isAssignableFrom() method is used to check whether the class or an interface den…

关于 列表实例

wss3.0工具中有个列表实例项目。此项目的作用是在自定义网站或自定义字段时使用默认值。也就是定义其默认的数据。 格式详见微软msdn&#xff1a;http://msdn.microsoft.com/zh-cn/library/ms478860.aspx转载于:https://www.cnblogs.com/heavencloud/archive/2009/03/20/141793…

WP7之Application Bar控件

Microsoft.Phone.Shell命名空间中定义了ApplicationBar及其相关类&#xff08;ApplicationBarIconButton和ApplicationBarMenuItem&#xff09;&#xff0c;这些类派生自Object,并完全独立于常规Silverlight编程中的DependencyObject,UIElement和FrameworkElement类层次结构。A…

TomCat使用以及端口号被占用的处理方法

一.HTTP协议 什么是HTTP协议 HTTP协议&#xff08;HyperText Transfer Protocol&#xff0c;超文本传输协议&#xff09;是因特网上应用最为广泛的一种网络传输协议&#xff0c;所有的WWW文件都必须遵守这个标准。 HTTP请求 HTTP响应 2.如何处理端口被占用 方法一&#xff…