mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-28 03:47:11 +08:00
修复TLS内存申请没有初始化问题
This commit is contained in:
parent
f7f0afe03e
commit
b19672ccc1
@ -54,9 +54,7 @@ int pthread_setspecific(pthread_key_t key, const void *value)
|
|||||||
/* check tls area */
|
/* check tls area */
|
||||||
if (ptd->tls == NULL)
|
if (ptd->tls == NULL)
|
||||||
{
|
{
|
||||||
ptd->tls = (void**)rt_malloc(sizeof(void*) * PTHREAD_KEY_MAX);
|
ptd->tls = (void**)rt_calloc(PTHREAD_KEY_MAX, sizeof(void*));
|
||||||
|
|
||||||
rt_memset(ptd->tls, 0, sizeof(void*) * PTHREAD_KEY_MAX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((key < PTHREAD_KEY_MAX) && _thread_keys[key].is_used)
|
if ((key < PTHREAD_KEY_MAX) && _thread_keys[key].is_used)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user