c# - Static member and lock -


i have class static member:

static mayclass s_member; 

it can accessed multiple threads. should use static lock object it?

if wish prevent concurrent access, need protect lock. if concurrent access presents no problems, there no need lock.

only knowledge of member can answer 1 way or another. threads access concurrently ever read? if so, not need lock. otherwise, if writing shared data, lock needed.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -