IIRC, the classic implementation of strtok uses a static char * to retain state between calls. That would make it thread unsafe. That is why there is a strtok_r that passes that value in and out, to be reentrant. >This one is the perfect example of self-contained function (not dealing with >IO or anything) that doesn't need to be taken care of. Except of course if >you implement it using global variables, but this would be very dumb :^) > >as long as it uses local variables *only* it can be considered as >intrinsically thread-safe, as each instance is fully located on the stack of >the calling thread. > >On the opposite every function that deals with something that belongs to a >whole team (memory, files, ...) must use locking (malloc(), fread, ...) > >François. > >