2 ms·
The C API was never designed with threading in mind. Not all platforms support threads so the old behavior must stay around.
by kevin_thibedeau 6y ago
The C API was never designed with threading in mind. Not all platforms support threads so the old behavior must stay around.
- souprock 6y agoSay 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)