15 Jul
2009
15 Jul
'09
4:46 p.m.
On Jul 15, 2009, at 4:53 AM, mike_wilson wrote: <snip>
Say one thread accesses the SetMyObject() , given that there is a lock in the function, it will also lock the GetMyObject() blocking any other thread from calling?
This kind of implies that wherever in the object there is a lock, any function owned by the object will be locked to any other thread trying to access. Is this correct?
You are correct. There is, however, a variant of mutex that allows for multiple readers to hold the lock simultaneously, but there can only be a single writer. All readers or other writers are locked out until the writer releases the lock. But if you mostly read this can reduce contention. - Rush