You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/06 02:58:12 UTC

[GitHub] [incubator-nuttx] no1wudi commented on a change in pull request #3858: tls: Move pthread key destructor to libc

no1wudi commented on a change in pull request #3858:
URL: https://github.com/apache/incubator-nuttx/pull/3858#discussion_r646064494



##########
File path: libs/libc/tls/tls_setdtor.c
##########
@@ -59,18 +56,16 @@
  *
  ****************************************************************************/
 
-int tls_set_dtor(int tlsindex, tls_dtor_t destr)
+int tls_set_dtor(int tlsindex, tls_dtor_t dtor)
 {
-  FAR struct tcb_s *rtcb = this_task();
-  FAR struct task_group_s *group = rtcb->group;
-  irqstate_t flags;
+  FAR struct task_info_s *tinfo = task_get_info();
 
-  DEBUGASSERT(group != NULL);
+  DEBUGASSERT(tinfo != NULL);
   DEBUGASSERT(tlsindex >= 0 && tlsindex < CONFIG_TLS_NELEM);
 
-  flags = spin_lock_irqsave(NULL);
-  group->tg_tlsdestr[tlsindex] = destr;
-  spin_unlock_irqrestore(NULL, flags);
+  sem_wait(&tinfo->ta_tlssem);

Review comment:
       The TLS key relative interface wouldn't be called from OS side, execpt **nx_pthread_exit** by syscall (drop to user space)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org