Hacker News new | past | comments | ask | show | jobs | submit login

Well, strtok could use thread local variables to store intermediate state, to make it threadsafe while maintaining the same API. Not saying this is a good idea, but technically it would work, no?



You could, but that would change the behaviour of existing programs. It might well be that there are well-defined programs out there that use strtok across separate, but properly synchronized, threads.

This is why it's crucial to get APIs right first time.


Yes, as long as you can guarantee that there’s only one tokenization going on per thread at a time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: