I've recently introduced a method
PlayerCollection.ForEachSync(Action) that used locking to assure that all elements of the
Player.players collection are iterated.
The simple lock was used. It's however not the optimal solution for multiple concurrent reads and relatively rare write operations. Fortunately there's another way to do it. I changed the simple lock to
ReadWriteLockSlim type. It allows multiple simultanous reads thus reducing the waiting time.
The above explanation to understand requires a basic knowledge of
threading and
thread synchronization.
In short, the server should work slightly faster.