3 ms·
Say what? You like to call plain strtok() from different threads, having them all update a shared global state? I think you missed the point here, because that
by souprock 6y ago
Say what? You like to call plain strtok() from different threads, having them all update a shared global state? I think you missed the point here, because that would be some really evil usage of the strtok() function.
We had "int errno" as global state. We fixed it, in a compatible way, to be thread-safe. Platforms without threads can still implement it the old way if desired.
The same kind of compatible fix could have been done with the strtok() function. There was no need to introduce another function.
Simply: the internal state of strtok() shall be distinct for each thread. (which is trivial if the platform only supports a single thread)