Hi,
I'm not sure what's going on here, looks like I'm having a deadlock for some reason, but I don't know why.
I have something like this:
// called inside an infinite loop in its own thread
void Render(){
mutex.lock();
// lots of stuff
mutex.unlock();
}
// a Windows event like a button pressed, etc
void SomeEvent(){
mutex.lock();
// a few updates here and there
mutex.unlock();
}
In some machines this runs without any problems, but on others when SomeEvent() gets called it gets stuck waiting for the lock, while Render() is still being called regularly inside its loop, locking() and unlocking() the mutex, as if there was no one else waiting for it.
This makes me wonder how the OS handles when someone is waiting for the mutex, is the waiting thread queued? or is it just polling the mutex every x time to see if it can lock the mutex until it succeeds? or what else is involved when a thread is waiting?
Any insight would be appreciated.
Thanks!