Monitor vs lock

后端 未结 9 2170
孤独总比滥情好
孤独总比滥情好 2020-11-27 11:42

When is it appropriate to use either the Monitor class or the lock keyword for thread safety in C#?

EDIT: It seems from th

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 12:02

    In addition to all above explanations, lock is a C# statement whereas Monitor is a class of .NET located in System.Threading namespace.

提交回复
热议问题