A function is not considered "thread safe" if it CANNOT be interrupted in the middle of its execution and then safely called again ("re-entered") before its previous calls are completed.
In the C standard library, some functions fall into this category. You don't need a tool like Valgrind to check thread safety, instead you should read the documentation (or the man page) for the specific function you're worried about.
Usually, but not always, C offers a reliable copy of the stream if the function is not stream safe.
For example, the string token function strtokhas a re-versionstrtok_r
char *strtok(char *str, const char *delim);
char *strtok_r(char *str, const char *delim, char **saveptr);
, () ( ) , . strtok_r .
, SO, Threadsafe vs re-entrant.
-
: . , , , . , ltrace, . , , C. .
Valgrind , Helgrind, (. http://valgrind.org/docs/manual/hg-manual.html, 7.1)