mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 18:56:10 +08:00
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:
committed by
Xiang Xiao
parent
f84d34a57b
commit
c54bee0295
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user