D
DAXU
Hello,
I did this as a test code:
public class test{
.....
.....
public void test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
}
}
I thought that when I run test(11), it should give me a deadlock as
first it asks to lock the instance of the class, then as i is bigger
than 10, it will go deeper and try to lock the instance of the class
again, as it has been locked, then it should just wait there for ever.
But it went through without any deadlock, can someone tell me what is
wrong with my understanding?
Many Thanks
Jerry
I did this as a test code:
public class test{
.....
.....
public void test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
}
}
I thought that when I run test(11), it should give me a deadlock as
first it asks to lock the instance of the class, then as i is bigger
than 10, it will go deeper and try to lock the instance of the class
again, as it has been locked, then it should just wait there for ever.
But it went through without any deadlock, can someone tell me what is
wrong with my understanding?
Many Thanks
Jerry