1

I am reading over the MSDN's tutorial on lock here http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx.

It says lock(this) is not a best practice if the instance is of public type. However I don't see why the instance being a public type would be a problem assuming lock owns the object atomically. Can anyone please shed a light? If that is not the case, I don't see though how a private object would help protect the critical section either?

as3rdaccount
  • 3,711
  • 12
  • 42
  • 62

0 Answers0