BugID:16851920:add pthread tsd support 2
@@ -34,6 +34,7 @@ void krhino_task_del_hook(ktask_t *task, res_free_t *arg)
{
_pthread_tcb_t *ptcb;
_pthread_cleanup_t *cleanup;
+ pthread_key_list_t *pthread_key_list_s_c = NULL;
g_sched_lock[cpu_cur_get()]++;
@@ -54,6 +55,16 @@ void krhino_task_del_hook(ktask_t *task, res_free_t *arg)
}
} while(ptcb->cleanup != NULL);
+ /* call the destructor function of TSD */
+ pthread_key_list_s_c = &pthread_key_list_head;
+ while (pthread_key_list_s_c != NULL) {
+ if (pthread_key_list_s_c->head.fun != NULL){
+ pthread_key_list_s_c->head.fun(NULL);
+ }
+
+ pthread_key_list_s_c = pthread_key_list_s_c->next;
+ }
+
if (ptcb->attr.detachstate == PTHREAD_CREATE_JOINABLE) {
/* give join sem if is joinable */
if (ptcb->join_sem != NULL) {
