I have code that contains a synchronized
block within a loop, something like that
while (true) {
synchronized (SOME_MUTEX) {
//some more code here
}
}
There is another thread that is running code that is synched with the same mutex. The thread above only reads, the other one only writes. the writing thread is being starved, and so updates don't come through. that would be fine even for a second or two, but the writing thread seems to be left out indefinitely.
I know with certainty that while this loop executes, the other thread also tries to get the mutex, and I do understand why it doesn't receive it while the above thread is executed, except for the times where the while loop reaches its end, and starts over a new iteration.
At this point the mutex should be release, shouldn't it? Shouldn't the other thread receive it at this point?
Thank you