[asterisk-dev] Astobj2 and locks
Watkins, Bradley
Bradley.Watkins at compuware.com
Wed Sep 12 21:02:41 CDT 2007
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.
Thanks for the explanation.
Regards,
- Brad
________________________________
>
> Do I have it all wrong somehow? And if so, please educate me as to how
> so that I may be enlightened.
It comes down to understanding exactly when and why the locking is required. In
some places in Asterisk, locks are used (and sometimes abused) to ensure that
the object we're looking at doesn't disappear. However, in this case, the
object has a reference count, and we currently hold a reference, so we know that
it will not disappear.
The lock for the member struct is still required in some situations, when you
need to protect certain elements of the member from changing while you're
working with them. In this case, there is no possibility for something to
change in the member that could cause this code to break. Thus, no locking is
required.
--
Russell Bryant
Software Engineer
Digium, Inc.
_______________________________________________
Sign up now for AstriCon 2007! September 25-28th. http://www.astricon.net/
--Bandwidth and Colocation Provided by http://www.api-digital.com-- <http://www.api-digital.com--/>
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20070912/4149ec26/attachment-0001.htm
More information about the asterisk-dev
mailing list