I have an application in which several threads share a mutex.
std::lock_guard< std::recursive_mutex > lock(globalMutex_);
One intensively (T1) the others lesser (T2,T3..). I have an example in which the threads which require the lock less often get blocked 100 seconds before successfully acquire the lock.
The tread (T1 so) which acquire the lock often do it in the following way :
void func()
{
std::lock_guard< std::recursive_mutex > lock(globalMutex_);
processing();
}
globalMutex_
is then well released periodically.
Strange behavior:
T1 get the lock systematically during a total period of 100 seconds while the other thread do not get the lock at all
(In other threads I have the same pattern but the other func is called less often)
Question: What can explain that ? Is it a normal behavior?
Context: I am under windows 10 / last version of Visual Studio / 64 bits / GUI application
Note: Even if I put T2 with a high priority, the situation is the same.