[asterisk-dev] [Code Review] Astobj2 locking enhancement
rmudgett
reviewboard at asterisk.org
Fri Feb 24 19:46:28 CST 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1554/
-----------------------------------------------------------
(Updated Feb. 24, 2012, 7:46 p.m.)
Review request for Asterisk Developers and David Vossel.
Changes
-------
Addressed Kevin's comments.
Pushed many general astobj2.h documentation changes to trunk to make API changes with this patch easier to see.
Summary (updated)
-------
Add the ability to specify what kind of locking an ao2 object has when it is allocated.
The locking could be one of: MUTEX, RWLOCK, or none.
New API:
ao2_t_alloc_options()
ao2_alloc_options()
ao2_t_container_alloc_options()
ao2_container_alloc_options()
ao2_rdlock()
ao2_wrlock()
ao2_tryrdlock()
ao2_trywrlock()
The OBJ_NOLOCK and AO2_ITERATOR_DONTLOCK flags have a slight meaning
change. They no longer mean that the object is protected by an external
mechanism. They mean the lock associated with the object has already been
manually obtained by one of the ao2_lock calls. This change is necessary
for RWLOCK support since they are not reentrant. Also an operation on an
ao2 container may require promoting a read lock to a write lock by
releasing the already held read lock to re-acquire as a write lock.
Replaced API calls:
ao2_t_link_nolock()
ao2_link_nolock()
ao2_t_unlink_nolock()
ao2_unlink_nolock()
with the respective
ao2_t_link_flags()
ao2_link_flags()
ao2_t_unlink_flags()
ao2_unlink_flags()
API calls to be more flexible and to allow anticipated flags to control
linking duplicate objects into a container.
The changes to format.c and format_cap.c are taking advantange of the new
ao2 locking options to simplify the use of the format capabilities
containers.
Diffs (updated)
-----
/trunk/main/format_cap.c 356796
/trunk/main/format.c 356796
/trunk/include/asterisk/astobj2.h 356796
/trunk/include/asterisk/lock.h 356796
/trunk/main/astobj2.c 356796
Diff: https://reviewboard.asterisk.org/r/1554/diff
Testing
-------
Ran the ao2 unit tests.
Thanks,
rmudgett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120225/a6131105/attachment-0001.htm>
More information about the asterisk-dev
mailing list