<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/4108/">https://reviewboard.asterisk.org/r/4108/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, George Joseph and rmudgett.</div>
<div>By Corey Farrell.</div>
<p style="color: grey;"><i>Updated March 4, 2015, 4:43 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I never much liked the API naming I originally chose, but was initially focused on getting this thread safe. I like Richard's idea that this is a weakproxy, so I've changed the code to use ao2_weakproxy as the namespace. The only exception being ao2_get_weakproxy, as this is run against "normal" AO2 objects. I've also made all ao2_weakproxy functions operate on weakproxy's only. These functions now reject normal AO2 objects where weakproxy is expected.
This change also makes it possible to efficiently use weakproxy's in containers, as the weakproxy can contain it's own fields. For weakproxy that may be put into containers, you would put the fields normally required for sort_fn, hash_fn and cmp_fn into the weakproxy.
One thing I don't like about the current API is the need to have 'struct ao2_weakproxy' as the first field of weakproxies. I know this could be avoided by moving the field into 'struct astobj2', I'm just not sure extra storage for all AO2 objects is acceptable. It could probably be done using another private structure (such as 'struct astobj2_lock'), but I'm not sure this is worth the added complexity to AO2.
I plan to add REF_DEBUG variants of some functions, I want to hold off on that until the API gets approval.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Summary (updated)</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Weak Proxy Objects</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description (updated)</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This implements "weak" references. The weakproxy object is a real ao2 with normal reference counting of its own. When a weakproxy is pointed to a normal object they hold references to each other. The normal object is automatically freed when a single reference remains (the weakproxy). The weakproxy also supports subscriptions that will notify callbacks when the normal object is about to be destroyed.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing (updated)</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ran the included test with REF_DEBUG enabled under valgrind. No reference leaks or improper memory access. Though this does not test for races, I don't know of an automated way to do that.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/tests/test_astobj2_weaken.c <span style="color: grey">(PRE-CREATION)</span></li>
<li>/trunk/main/astobj2.c <span style="color: grey">(432445)</span></li>
<li>/trunk/include/asterisk/astobj2.h <span style="color: grey">(432445)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/4108/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>