class Program
{
static object test = new object();
static void Main(string[] args)
{
new Program().test2();
Console.ReadKey();
}
public void test1()
{
lock (test)
{
Console.WriteLine("test1");
}
}
public void test2()
{
lock (test)
{
test1();
Console.WriteLine("test2");
}
}
}
Is the code above supposed to first finish statements in lock statement of test2() then go to the test1()? (i.e. Doesn't the output supposed to be like this? : test2 test1 )