Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove TLS pointer/deletion callback from correct thread (IDFGH-13144) #14084

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/pthread/pthread_local_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ static void pthread_cleanup_thread_specific_data_callback(int index, void *v_tls
free(tls);
}

/* this function called from pthread_task_func for "early" cleanup of TLS in a pthread */
/* this function called from pthread_task_func for "early" cleanup of TLS in a pthread
and from pthread_join/pthread_detach for cleanup of TLS after pthread exit
*/
void pthread_internal_local_storage_destructor_callback(TaskHandle_t handle)
{
void *tls = pvTaskGetThreadLocalStoragePointer(handle, PTHREAD_TLS_INDEX);
Expand All @@ -157,9 +159,9 @@ void pthread_internal_local_storage_destructor_callback(TaskHandle_t handle)
calling it again...
*/
#if !defined(CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS)
vTaskSetThreadLocalStoragePointer(NULL, PTHREAD_TLS_INDEX, NULL);
vTaskSetThreadLocalStoragePointer(handle, PTHREAD_TLS_INDEX, NULL);
#else
vTaskSetThreadLocalStoragePointerAndDelCallback(NULL,
vTaskSetThreadLocalStoragePointerAndDelCallback(handle,
PTHREAD_TLS_INDEX,
NULL,
NULL);
Expand Down
Loading