libc/pthread/pthread_keydelete.c: reset key value

When key is deleted, its value should also be reset.

This fixes the pthread_getspecific.c test case from
PSE52 Open Group Threads Test Suite.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz
2025-09-15 12:02:17 +02:00
committed by Xiang Xiao
parent f84d34a57b
commit c54bee0295
+3 -1
View File
@@ -60,9 +60,10 @@
int pthread_key_delete(pthread_key_t key)
{
FAR struct task_info_s *info = task_get_info();
FAR struct tls_info_s *tls = tls_get_info();
int ret = EINVAL;
DEBUGASSERT(info != NULL);
DEBUGASSERT(info != NULL && tls != NULL);
DEBUGASSERT(key >= 0 && key < CONFIG_TLS_NELEM);
if (key >= 0 && key < CONFIG_TLS_NELEM)
{
@@ -74,6 +75,7 @@ int pthread_key_delete(pthread_key_t key)
if (ret == OK)
{
info->ta_tlsdtor[key] = NULL;
tls->tl_elem[key] = 0;
nxmutex_unlock(&info->ta_lock);
}
else