patacongo commented on pull request #3170: URL: https://github.com/apache/incubator-nuttx/pull/3170#issuecomment-806856359
> Yes, but it waste other thread local storage. We can simulate per-task variable from per-thread variable, but I don't think this is right approach from both the concept and implementation(memory) perspective. As soon as the pthread key is allocated, all of the pointers in all threads in all tasks are committed to that single purpose and cannot be used for anything else. Nothing additional is wasted by setting the value to point to a common structure. The only way to avoid that would be to use hard-coded structures in TLS as you suggested. Would that hard coded structure only exist for the main thread? I don't think that is do-able. I think TLS must be the same structure in all threads. But I would have to look at that more. -- 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: [email protected]
