Every time I try to lookup the definition of "thread-safe" I get told that a routine is thread-safe if it can be called by more than 1 thread at the same time. (They also seem to be very Java-oriented, in which this definition might be sufficient) But this seams to mean if that if a function is not thread-safe, then it's ok if that function only gets called by one thread. Or does it?
Suppose foo() is declared not thread-safe because it calls the POSIX function asctime(), which returns a pointer to static space, rather than its reentrant counterpart, asctime_r(). One might think that it's ok to have multiple threads in one's program, as long as foo() calls are confined to just 1 thread, but suppose another thread calls asctime()? It seems to me that if something is not thread-safe then that kills your freedom to use any other code that isn't thread-safe either.
I don't know if I'm using "thread-safe" here properly, but I've definitely hit upon a problem of concurrency that deserves to have a name. So what is it?