Tuesday, September 20, 2022

C# - Lock Rule

Tips

  1. In each class, lock every public methods and any methods triggered by event from other classes.
  2. For each methods, lock the entire code from start until the end of method by default. Reducing the lock coverage to only certain part of code in a method can be done carefully after this as an optimization.
  3. Triggering event should not be performed from inside a lock.

No comments:

Post a Comment