From 04969843388ad1bb76534354d5241f4eb773b5a1 Mon Sep 17 00:00:00 2001 From: zhangbo56 Date: Fri, 31 May 2024 12:05:34 +0800 Subject: [PATCH] libc: Add debug assert to prevent tls allocation failure So It's easy to find TASK_TLS_ELEM not enough error. Signed-off-by: zhangbo56 --- libs/libc/tls/task_tls_destruct.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/libc/tls/task_tls_destruct.c b/libs/libc/tls/task_tls_destruct.c index 4bbbba5aec..1c14f2cfc2 100644 --- a/libs/libc/tls/task_tls_destruct.c +++ b/libs/libc/tls/task_tls_destruct.c @@ -31,6 +31,7 @@ #include #include +#include /**************************************************************************** * Private Data @@ -104,6 +105,9 @@ int task_tls_alloc(tls_dtor_t dtor) } nxmutex_unlock(&g_tlslock); + + DEBUGASSERT(ret != -EUSERS); + return ret; }