mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-23 11:09:28 -05:00
Delete tasks in multithreaded demo (#339)
Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
This commit is contained in:
parent
2134bd6619
commit
c0591f4658
1 changed files with 10 additions and 10 deletions
|
|
@ -38,10 +38,6 @@
|
||||||
* received. Each task has a queue to hold received publish messages,
|
* received. Each task has a queue to hold received publish messages,
|
||||||
* and the command task pushes incoming publishes to the queue of each task
|
* and the command task pushes incoming publishes to the queue of each task
|
||||||
* that is subscribed to the incoming topic.
|
* that is subscribed to the incoming topic.
|
||||||
*
|
|
||||||
* !!! NOTE !!!
|
|
||||||
* This MQTT demo does not authenticate the server nor the client.
|
|
||||||
* Hence, this demo should not be used as production ready code.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
|
|
@ -1649,8 +1645,12 @@ void prvPublishTask( void * pvParameters )
|
||||||
/* Clear this task's notifications. */
|
/* Clear this task's notifications. */
|
||||||
xTaskNotifyStateClear( NULL );
|
xTaskNotifyStateClear( NULL );
|
||||||
|
|
||||||
/* Notify main task this task can be deleted. */
|
/* Notify main task this task has completed. */
|
||||||
xTaskNotify( xMainTask, mqttexamplePUBLISHER_TASK_COMPLETE_BIT, eSetBits );
|
xTaskNotify( xMainTask, mqttexamplePUBLISHER_TASK_COMPLETE_BIT, eSetBits );
|
||||||
|
|
||||||
|
/* Delete this task. */
|
||||||
|
LogInfo( ( "Deleting Publisher task." ) );
|
||||||
|
vTaskDelete( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
@ -1755,8 +1755,12 @@ void prvSubscribeTask( void * pvParameters )
|
||||||
/* Ensure command was added to queue. */
|
/* Ensure command was added to queue. */
|
||||||
configASSERT( xCommandAdded == pdTRUE );
|
configASSERT( xCommandAdded == pdTRUE );
|
||||||
|
|
||||||
/* Notify main task this task can be deleted. */
|
/* Notify main task this task has completed. */
|
||||||
xTaskNotify( xMainTask, mqttexampleSUBSCRIBE_TASK_COMPLETE_BIT, eSetBits );
|
xTaskNotify( xMainTask, mqttexampleSUBSCRIBE_TASK_COMPLETE_BIT, eSetBits );
|
||||||
|
|
||||||
|
/* Delete this task. */
|
||||||
|
LogInfo( ( "Deleting Subscriber task." ) );
|
||||||
|
vTaskDelete( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
@ -1844,8 +1848,6 @@ static void prvMQTTDemoTask( void * pvParameters )
|
||||||
}
|
}
|
||||||
|
|
||||||
configASSERT( ( ulNotification & mqttexampleSUBSCRIBE_TASK_COMPLETE_BIT ) == mqttexampleSUBSCRIBE_TASK_COMPLETE_BIT );
|
configASSERT( ( ulNotification & mqttexampleSUBSCRIBE_TASK_COMPLETE_BIT ) == mqttexampleSUBSCRIBE_TASK_COMPLETE_BIT );
|
||||||
vTaskDelete( xSubscribeTask );
|
|
||||||
LogInfo( ( "Subscribe task Deleted." ) );
|
|
||||||
|
|
||||||
/* Wait for publishing task to exit before cleaning up. */
|
/* Wait for publishing task to exit before cleaning up. */
|
||||||
while( ( ulNotification & mqttexamplePUBLISHER_TASK_COMPLETE_BIT ) != mqttexamplePUBLISHER_TASK_COMPLETE_BIT )
|
while( ( ulNotification & mqttexamplePUBLISHER_TASK_COMPLETE_BIT ) != mqttexamplePUBLISHER_TASK_COMPLETE_BIT )
|
||||||
|
|
@ -1855,8 +1857,6 @@ static void prvMQTTDemoTask( void * pvParameters )
|
||||||
}
|
}
|
||||||
|
|
||||||
configASSERT( ( ulNotification & mqttexamplePUBLISHER_TASK_COMPLETE_BIT ) == mqttexamplePUBLISHER_TASK_COMPLETE_BIT );
|
configASSERT( ( ulNotification & mqttexamplePUBLISHER_TASK_COMPLETE_BIT ) == mqttexamplePUBLISHER_TASK_COMPLETE_BIT );
|
||||||
vTaskDelete( xPublisherTask );
|
|
||||||
LogInfo( ( "Publish task Deleted." ) );
|
|
||||||
|
|
||||||
/* Reset queues. */
|
/* Reset queues. */
|
||||||
xQueueReset( xCommandQueue );
|
xQueueReset( xCommandQueue );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue