v01d commented on pull request #3170: URL: https://github.com/apache/incubator-nuttx/pull/3170#issuecomment-806689780
> BTW, for the variables used in libc, would it better to declare them in the per stask/thread struct directly? So, all pthread slot reserve to the end user, the benefit include: > > 1. Same approach as errno > > 2. Avoid the complex initialization(e.g. allocate the key) > > 3. Can proceed before #1263 The problem with that is that every thread will have a copy of all those variables even when they are never used. I suggested that we initialize those when needed, by only storing a pointer to a struct holding those variables in the TLS struct. This allocation could be done once per task (I don't know exactly how but I guess it should be possible). If we store a pointer, we can either use the pthread key approach (more standard) with a reserved slot as in this PR or add an explicit extra variable (`struct task_globals_s *globals`?). I don't have a strong preference there but I'm guessing Greg was going for the standard interface approach. -- 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]
