Do static locks work across different children classes?

后端 未结 3 1333
轮回少年
轮回少年 2021-01-05 10:05

If I have

abstract class Parent
{
    static object staticLock = new object();

    public void Method1()
    {
        lock(staticLock)
        {
                   


        
3条回答
  •  情歌与酒
    2021-01-05 10:21

    To add to ken2k's answer: [Yes] ... unless it's marked as [ThreadStatic] (which obviously isn't the case here).

提交回复
热议问题