I've looked around SO and the web for an answer but have only found one for other languages (c++, python) and reading hasn't quite provided a clear enough answer.
If a thread has a block of code that gets locked, and the thread dies for some reason (forcefully killed) while it is inside of the locked block, will the lock still be enforced (ie, other threads won't be able to use obtain that lock)?
Such as:
class myClass {
private static object myLock = new Object();
public void foobar()
{
lock(myLock)
{
//code
}
}
}
If thread A dies and thread B attempts to call foobar, will it be able to? or will it deadlock?