[asterisk-commits] dlee: trunk r382724 - in /trunk: include/asterisk/stasis.h main/stasis_cache.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 8 10:59:06 CST 2013


Author: dlee
Date: Fri Mar  8 10:59:02 2013
New Revision: 382724

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382724
Log:
Stasis documentation updates.

(issue ASTERISK-20887)
(issue ASTERISK-20959)


Modified:
    trunk/include/asterisk/stasis.h
    trunk/main/stasis_cache.c

Modified: trunk/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/stasis.h?view=diff&rev=382724&r1=382723&r2=382724
==============================================================================
--- trunk/include/asterisk/stasis.h (original)
+++ trunk/include/asterisk/stasis.h Fri Mar  8 10:59:02 2013
@@ -35,9 +35,6 @@
  * within Asterisk. It is designed to be:
  *  - Loosely coupled; new message types can be added in seperate modules.
  *  - Easy to use; publishing and subscribing are straightforward operations.
- *  - Consistent memory management; all message bus objects are AO2 managed
- *    objects, using ao2_ref() and ao2_cleanup() to manage the reference
- *    counting.
  *
  * There are three main concepts for using the Stasis Message Bus:
  *  - \ref stasis_message
@@ -75,11 +72,12 @@
  * to the topic is dispatched to all of its subscribers. The topic itself may be
  * named, which is useful in debugging.
  *
- * Topics themselves are reference counted objects, and automagically
- * unsubscribe all of their subscribers when they are destroyed. Topics are also
- * thread safe, so no worries about publishing/subscribing/unsubscribing to a
- * topic concurrently from multiple threads. It's also designed to handle the
- * case of unsubscribing from a topic from within the subscription handler.
+ * Topics themselves are reference counted objects. Since topics are referred to
+ * by their subscibers, they will not be freed until all of their subscribers
+ * have unsubscribed. Topics are also thread safe, so no worries about
+ * publishing/subscribing/unsubscribing to a topic concurrently from multiple
+ * threads. It's also designed to handle the case of unsubscribing from a topic
+ * from within the subscription handler.
  *
  * \par Forwarding
  *
@@ -110,8 +108,10 @@
  * removed from the cache). A stasis_cache_clear_create() message must be sent
  * to the topic in order to remove entries from the cache.
  *
- * As with all things Stasis, the \ref stasis_caching_topic is a reference
- * counted AO2 object.
+ * In order to unsubscribe a \ref stasis_caching_topic from the upstream topic,
+ * call stasis_caching_unsubscribe(). Due to cyclic references, the \ref
+ * stasis_caching_topic will not be freed until after it has been unsubscribed,
+ * and all other ao2_ref()'s have been cleaned up.
  *
  * \par stasis_subscriber
  *
@@ -122,12 +122,10 @@
  * threads (this usually isn't important unless you use thread locals or
  * something similar).
  *
- * Since the topic (by necessity) holds a reference to the subscription,
- * reference counting alone is insufficient to terminate a subscription. In
- * order to stop receiving messages, call stasis_unsubscribe() with your \ref
- * stasis_subscription. This will remove the topic's reference to the
- * subscription, and allow it to be destroyed when all of the other references
- * are cleaned up.
+ * In order to stop receiving messages, call stasis_unsubscribe() with your \ref
+ * stasis_subscription. Due to cyclic references, the \ref
+ * stasis_subscription will not be freed until after it has been unsubscribed,
+ * and all other ao2_ref()'s have been cleaned up.
  */
 
 #include "asterisk/utils.h"

Modified: trunk/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_cache.c?view=diff&rev=382724&r1=382723&r2=382724
==============================================================================
--- trunk/main/stasis_cache.c (original)
+++ trunk/main/stasis_cache.c Fri Mar  8 10:59:02 2013
@@ -42,6 +42,7 @@
 #define NUM_CACHE_BUCKETS 563
 #endif
 
+/*! \private */
 struct stasis_caching_topic {
 	struct ao2_container *cache;
 	struct stasis_topic *topic;




More information about the asterisk-commits mailing list