Daily bit(e) of C++ | std::recursive_mutex
Daily bit(e) of C++ ♻️13, The recursive variant of mutex that allows multiple locks by the same thread: std::recursive_mutex.
The std::recursive_mutex is a mutex variant that can be locked multiple times by the same thread. Other threads can only acquire a lock on the mutex after all held locks have been released.
This can significantly simplify code where several functions need to acquire the lock and call each other.