Skip to content

Commit 71d7d08

Browse files
Delete the ChipEventQueue and BackgroundEventQueue after returning from the event loop
1 parent e86768b commit 71d7d08

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp

+6-3
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ void GenericPlatformManagerImpl_FreeRTOS<ImplClass>::EventLoopTaskMain(void * ar
278278
{
279279
ChipLogDetail(DeviceLayer, "CHIP event task running");
280280
static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->Impl()->RunEventLoop();
281-
// TODO: At this point, should we not
282-
// vTaskDelete(static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->mEventLoopTask)?
283-
// Or somehow get our caller to do it once this thread is joined?
281+
vTaskDelete(NULL);
282+
vQueueDelete(static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->mChipEventQueue);
283+
static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->mChipEventQueue = NULL;
284284
}
285285

286286
template <class ImplClass>
@@ -377,6 +377,9 @@ void GenericPlatformManagerImpl_FreeRTOS<ImplClass>::BackgroundEventLoopTaskMain
377377
{
378378
ChipLogDetail(DeviceLayer, "CHIP background task running");
379379
static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->Impl()->RunBackgroundEventLoop();
380+
vTaskDelete(NULL);
381+
vQueueDelete(static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->mBackgroundEventQueue);
382+
static_cast<GenericPlatformManagerImpl_FreeRTOS<ImplClass> *>(arg)->mBackgroundEventQueue = NULL;
380383
}
381384
#endif
382385

0 commit comments

Comments
 (0)