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 2020/07/01 16:08:01 UTC

[GitHub] [incubator-nuttx] antmerlino edited a comment on pull request #1328: [DRAFT] pthread_cleanup functions must be called from user space

antmerlino edited a comment on pull request #1328:
URL: https://github.com/apache/incubator-nuttx/pull/1328#issuecomment-652509617


   > > There is a complexity... pthread_exit() is also called from within the OS from task_cancelpt.c, pthread_cancel.c, pthread_create.c, sig_default.c, task_cancelpt.c, task_setcancelstate.c, task_setcanceltype.c. This may require another system call analogous to up_pthread_start().
   > 
   > The calls to pthread_exit() from the cancellation logic within the OS is a potential show-stopper. Or certainly a reason to stop and re-consider how thread cancellation should work. Thread cancellation should also be primarily a user-space implementation as well.
   
   @gregory-nutt 
   
   I've now merged my branch in and am ready to put some time towards this.  It sounds like the next big step is to unify the thread cancellation logic - we will definitely need to do some good testing on this!
   
   All of these make sense. I could take care of those.
   
   a. Rename pthread_exit() to nx_pthread_exit(). Remove logic that calls pthread_cleanup() functions.
   b. Make nx_pthread_exit() a system call.
   c. Create libc/pthread/pthread_exit() that contains only i) the logic that calls the pthread_cleanup functions, and ii) calls the nx_pthread_exit() system call.
   d. Extend TLS and pthread-specific data function so that the destructor is retained in TLS
   e. Extend pthread_exit() so that it also calls the pthread-specific data destructors from user-space.
   
   But I feel like we should figure out the cancellation stuff before I do any of that. 
   
   > There is a complexity... pthread_exit() is also called from within the OS from task_cancelpt.c, pthread_cancel.c, pthread_create.c, sig_default.c, task_cancelpt.c, task_setcancelstate.c, task_setcanceltype.c. This may require another system call analagous to up_pthread_start().
   
   I don't really understand what the analogous call would do for us there, could you expand?
   


----------------------------------------------------------------
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