Simple Multithread Timer
Basically you are working with these class members inside the thread functions _temporize and _sleepThenTimeout.


timeout, _isSingleShort and _interval, these three cannot be changed after the start function is called, so it is safe to use them.
_running on the other hand can be read/write by both threads. In reality it might not cause any problem as assignment to bool is atomic (on most architectures), but to be 100% safe you can use std::atomic&lt;bool&gt;.


Another important thing to keep in mind is that while timer class itself is thread safe, it is responsibility of the user of this class to make sure that the timer call back function (_timeout) is thread-safe by it self, as it will be executed in a separate thread.