DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Task-specific data is implemented by keeping such globals in the stack of the main thread. A single main thread is always present and, hence, provides user-accessible, per-task storage. Task-specific data is accessed via TLS: The TLS data of each thread includes a reference to the main thread's task-specific globalslike TLS except that the task-specific data is accessed from the stack of the main thread, rather than the stack stack of the main thread.
Re-Entrant getopt()
One use of task-specific data is for global variables used by the getopt() function. getopt() is an important C library function used by applications for parsing of task command line parameters. It is, however, not re-entrant due to the use of global variables: optarg, opterr, optind, and optopt. There are several, non-standard implementations for a re-entrant version of called getopt_r(), however, these are all wildly different and do not conform to any standard. Non-standard interfaces are not desirable in NuttX.
...
TLS data is always located at the beginning thread's stack. This is true for both CPUs with push-up stacks and CPUs with push-down stacks. This location required in order to access the TLS by ANDing the aligned stack pointer address. The stack memory maps, however, then look very different:differ only in the usage of the available stack
Push Down Push Up+-------------+ +-------------+ <- Stack memory allocation| TLS Data | | TLS Data |+-------------+ +-------------+| Task Data* | | Task Data* || Available | +-------------+ +-------------+| Stack Arguments | | Arguments || | +-------------+ +-------------+ || | | | v| Available | | Available | || Stack | | Stack | v| | ^ | |+-------------+ | | || Arguments | | |+-------------+ | | | || Task Data* | | ^ | |+-------------+ | +-------------+
* Task data is allocated in the main's thread's stack only
...