Made static nWarn thread-safe via std::atomic

nWarn is used to only allow at most 5 Info messages to be sent when particilar functions are called. The `static int` was changed to a `static std::atomic<int>` so the increment is done in a thread safe manner.
The thread-safety checker says this indirectly affects 116 modules.