[asterisk-dev] Astobj2 and locks

Watkins, Bradley Bradley.Watkins at compuware.com
Thu Sep 13 04:15:29 CDT 2007


 


> Kevin P. Fleming wrote:
>
> Watkins, Bradley wrote:
> > OK, that makes sense.  I was under the impression the lock was
required for any kind of change.  But we're most concerned the rug being
pulled out from underneath us then.
> 
> It *would* be required if you changed multiple elements in 
> the structure
> and other readers of that structure might misinterpret the 
> contents when
> one element has been changed but the others have not. In the case of
> changing only one element, or changing elements that are completely
> unrelated to each other, it may be safe to change those 
> elements without
> holding a lock on the structure.
> 

Ah, that jibes with what I *thought* I knew much better (though still a
difference, since you imply that changing multiple, unrelated elements
can be done without a lock).  So I'm not completely off-base, but the
particular example I showed doesn't require a lock since it's only
changing one element of the structure.  Is that correct then?

- Brad



More information about the asterisk-dev mailing list