When using simple data types that needs to be updated, for example, a simple bool or a integer counter, using std::atomic will almost yield better performance than using a mutex.
For example, instead of doing :
int counter; .... mu.lock(); counter++; mu.unlock();
Try:
std::atomic<int> counter; ... counter++;