QueueHandle_t xQueue1, xQueue2;
/* Create a queue capable of containing 10 unsigned long values. */
xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
if( xQueue1 == NULL )
{
/* Queue was not created and must not be used. */
}
/* Create a queue capable of containing 10 pointers to AMessage
structures. These are to be queued by pointers as they are
relatively large structures. */
xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
if( xQueue2 == NULL )
{
/* Queue was not created and must not be used. */
}
1条答案
按热度按时间uxhixvfz1#
从FreeRtos文档中,它建议传递指向大型结构的指针是可以的。对于任务间内存访问,最安全的选择是使用锁,并且所引用的内存不应该是动态内存。
字符串
Mastering the FreeRTOS Real Time Kernel - a Hands On Tutorial Guide的第154页也提供了一些见解。