summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-09-06 12:14:03 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-09-06 12:14:03 -0500
commitb5e4445b297beb3a8fa3e0afd4829b134ca912db (patch)
treead606a6de75d205a0055edc8d574b448eecc1d4a /include
parent825d6e036c29b4b5256b867bf4619ab969b2231c (diff)
parente875e1c12a4b954b18e136b25c2a83b5f8e15f5d (diff)
Merge "sorcery: Create function ast_sorcery_lockable_alloc."
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/sorcery.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/asterisk/sorcery.h b/include/asterisk/sorcery.h
index 23219ec41..896633816 100644
--- a/include/asterisk/sorcery.h
+++ b/include/asterisk/sorcery.h
@@ -988,10 +988,30 @@ int ast_sorcery_changeset_create(const struct ast_variable *original, const stru
*
* \retval non-NULL success
* \retval NULL failure
+ *
+ * \note The returned object does not support AO2 locking.
*/
void *ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor);
/*!
+ * \since 14.1.0
+ * \brief Allocate a generic sorcery capable object with locking.
+ *
+ * \details Sorcery objects may be replaced with new allocations during reloads.
+ * If locking is required on sorcery objects it must be shared between the old
+ * object and the new one. lockobj can be any AO2 object with locking enabled,
+ * but in most cases named locks should be used to provide stable locking.
+ *
+ * \param size Size of the object
+ * \param destructor Optional destructor function
+ * \param lockobj An AO2 object that will provide locking.
+ *
+ * \retval non-NULL success
+ * \retval NULL failure
+ */
+void *ast_sorcery_lockable_alloc(size_t size, ao2_destructor_fn destructor, void *lockobj);
+
+/*!
* \brief Allocate an object
*
* \param sorcery Pointer to a sorcery structure