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

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

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