I'm working on a project that's heavily multi-threaded, and was wondering if there's a way to have the compiler flag the use of non-reentrant calls to the C library (e.g. strtok intsead of strtok_r)? If not, is there a list of calls that are non-reentrant so I can grep through my code base periodically?
A related question is if there's a way to flag 3d party library use of non-reentrant calls.
I'm assuming reentrancy implies thread-safety, but not necessarily the other way around. Is there a good reason to use non-reentrant calls in a threaded project?
rand()
is a philosophical question anyway. A perfectrand
implementation (an oracle) would inherently be threadsafe. – Cubature