Do I need locks anytime I read other classes' fields in a multithread app?

Viewed 34

I am writing a game server and I am not exactly sure if I need to lock even things like that:

 public string Name
        {
            get { return this.pName; }
            protected set
            {
                this.pName = value;
            }
        }

then an example from an NPC class:

 public virtual void CalculateHitDamage(Player p, int dmg)
        {
            this.pLastAttackerName = p.Name;
....

As Player requests are processed usinsg the threadpool, should I make sure that all fields are protected with locks? In this case, the Name field?

0 Answers
Related