From 75162adf6868031057a83b0b7215d42edf1a4087 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Thu, 19 Dec 2024 07:55:27 +0100 Subject: [PATCH] Improve assert in completed_task_ans() This assert checks if the structure is correctly initialized. The structure is one-time use so the assert is valid, but the value of the atomic was added to the output to improve debugging. --- common/utils/threadPool/task_ans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/utils/threadPool/task_ans.c b/common/utils/threadPool/task_ans.c index 5a1a2c8764..f7e876568f 100644 --- a/common/utils/threadPool/task_ans.c +++ b/common/utils/threadPool/task_ans.c @@ -31,8 +31,8 @@ void completed_task_ans(task_ans_t* task) { DevAssert(task != NULL); - if (atomic_load_explicit(&task->status, memory_order_acquire) != 0) - AssertFatal(0, "Task already finished?"); + int status = atomic_load_explicit(&task->status, memory_order_acquire); + AssertFatal(status == 0, "Task not expected to be finished here. Status = %d\n", status); atomic_store_explicit(&task->status, 1, memory_order_release); }