Tool/software: TI C/C++ Compiler
Looking at the TI compiler's definition for strtok (v15.12.3), there's a comment there that says the following:
/*--------------------------------------------------------------------------*/ /* We give each thread its own copy of 'last_end' to protect threads from */ /* each other when calls to strtok() from separate threads overlap. */ /* However, the strtok() is still not re-entrant. Within a single thread, */ /* the 'last_end' pointer maintains a state which carries over successive */ /* calls to strtok() from the same thread. */ /*--------------------------------------------------------------------------*/
Is it true that the TI compiler creates a 'last_end' for every task/thread in the case of an ARM processor? When I try to create thread local variables with '__thread' in my main program, the compiler generally fails to recognize that keyword. TI doesn't include a thread-safe implementation like 'strtok_r' either.