summaryrefslogtreecommitdiff
path: root/include/asterisk/astobj2.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk/astobj2.h')
-rw-r--r--include/asterisk/astobj2.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index 28ae73e87..a18f099c0 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -671,6 +671,10 @@ int ao2_weakproxy_subscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, v
* of the cb / data pair. If it was subscribed multiple times it must be
* unsubscribed as many times. The OBJ_MULTIPLE flag can be used to remove
* matching subscriptions.
+ *
+ * \note When it's time to run callbacks they are copied to a temporary list so the
+ * weakproxy can be unlocked before running. That means it's possible for
+ * this function to find nothing before the callback is run in another thread.
*/
int ao2_weakproxy_unsubscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags);
@@ -854,11 +858,9 @@ struct ao2_global_obj {
* \return Nothing
*/
#define ao2_t_global_obj_release(holder, tag) \
- __ao2_global_obj_release(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+ __ao2_global_obj_replace_unref(&holder, NULL, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_release(holder) \
- __ao2_global_obj_release(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
-
-void __ao2_global_obj_release(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name);
+ __ao2_global_obj_replace_unref(&holder, NULL, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
/*!
* \brief Replace an ao2 object in the global holder.
@@ -1773,6 +1775,17 @@ void *__ao2_callback_data(struct ao2_container *c, enum search_flags flags,
void *__ao2_find(struct ao2_container *c, const void *arg, enum search_flags flags,
const char *tag, const char *file, int line, const char *func);
+/*!
+ * \brief Perform an ao2_find on a container with ao2_weakproxy objects, returning the real object.
+ *
+ * \note Only OBJ_SEARCH_* and OBJ_NOLOCK flags are supported by this function.
+ * \see ao2_callback for description of arguments.
+ */
+#define ao2_weakproxy_find(c, arg, flags, tag) \
+ __ao2_weakproxy_find(c, arg, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+void *__ao2_weakproxy_find(struct ao2_container *c, const void *arg, enum search_flags flags,
+ const char *tag, const char *file, int line, const char *func);
+
/*! \brief
*
*