aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/astobj2.h
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-30 19:34:47 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-30 19:34:47 +0000
commit7cfa10f05b13911f3595a3db8b058ee587dfd8d5 (patch)
tree7a9b4cd5fcd7c6762668e03902ccc2b5f07e8343 /include/asterisk/astobj2.h
parent2393a4999d3cee78abaec1ff3244bd320d59fb97 (diff)
Merged revisions 90348 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r90348 | russell | 2007-11-30 13:26:04 -0600 (Fri, 30 Nov 2007) | 8 lines Change the behavior of ao2_link(). Previously, in inherited a reference. Now, it automatically increases the reference count to reflect the reference that is now held by the container. This was done to be more consistent with ao2_unlink(), which automatically releases the reference held by the container. It also makes it so it is no longer possible for a pointer to be invalid after ao2_link() returns. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@90351 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/astobj2.h')
-rw-r--r--include/asterisk/astobj2.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index 4c35c4641..c19ab683a 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -119,12 +119,6 @@ The function returns NULL in case of errors (and the object
is not inserted in the container). Other values mean success
(we are not supposed to use the value as a pointer to anything).
-\note inserting an object in a container grabs the reference
-to the object (which is now owned by the container), so we do not
-need to drop our reference - in fact, we don't own it anymore,
-so we are not even supposed to access the object as someone might
-delete it.
-
\note While an object o is in a container, we expect that
my_hash_fn(o) will always return the same value. The function
does not lock the object to be computed, so modifications of
@@ -352,18 +346,25 @@ int ao2_container_count(struct ao2_container *c);
* We can use the functions below on any kind of
* object defined by the user.
*/
+
/*!
- * Add an object to a container.
+ * \brief Add an object to a container.
*
* \param c the container to operate on.
* \param newobj the object to be added.
- * \return NULL on errors, other values on success.
*
- * This function insert an object in a container according its key.
+ * \retval NULL on errors
+ * \retval newobj on success.
+ *
+ * This function inserts an object in a container according its key.
*
* \note Remember to set the key before calling this function.
+ *
+ * \note This function automatically increases the reference count to account
+ * for the reference that the container now holds to the object.
*/
void *ao2_link(struct ao2_container *c, void *newobj);
+
/*!
* \brief Remove an object from the container
*
@@ -377,9 +378,7 @@ void *ao2_link(struct ao2_container *c, void *newobj);
* be called.
*
* \note If the object gets unlinked from the container, the container's
- * reference to the object will be automatically released. This is
- * slightly different than ao2_link(), which inherits a reference instead
- * of automatically increasing the reference count.
+ * reference to the object will be automatically released.
*/
void *ao2_unlink(struct ao2_container *c, void *obj);