patacongo commented on pull request #3170: URL: https://github.com/apache/incubator-nuttx/pull/3170#issuecomment-806718751
> 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. I basically agree. I think we need to have a generic, extensible what to handle this that does not burden all threads (or at least no more than a pointer). Hardcoding the getopt() varialbes will burden all threads. The current approach will (typically) only affed the main thread. -- 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]
