summaryrefslogtreecommitdiff
path: root/include/asterisk/named_locks.h
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2016-08-18 14:28:57 -0400
committerCorey Farrell <git@cfware.com>2016-09-02 09:13:45 -0400
commit131baf70d6f349f7adee81419410f78790c0ebda (patch)
tree6ad4e5fefd35ee2b7020a73e0c85d078aec9a6c9 /include/asterisk/named_locks.h
parent0c5b6e9ff559dcb20d9315154d4bd6a2ea5aa6a9 (diff)
named_locks: Use ao2_weakproxy to deal with cleanup from container.
This allows standard ao2 functions to be used to release references to an ast_named_lock. This change can cause less frequent locking of the global named_locks container. The container is no longer locked when a named_lock reference is being release except when this causes the named_lock to be destroyed. Change-Id: I644e39c6d83a153d71b3fae77ec05599d725e7e6
Diffstat (limited to 'include/asterisk/named_locks.h')
-rw-r--r--include/asterisk/named_locks.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/include/asterisk/named_locks.h b/include/asterisk/named_locks.h
index 0fe07d992..1959841d0 100644
--- a/include/asterisk/named_locks.h
+++ b/include/asterisk/named_locks.h
@@ -48,7 +48,7 @@
* To use a named lock:
* Call ast_named_lock_get with the appropriate keyspace and key.
* Use the standard ao2 lock/unlock functions as needed.
- * Call ast_named_lock_put when you're finished with it.
+ * Call ao2_cleanup when you're finished with it.
*/
/*!
@@ -66,9 +66,6 @@ struct ast_named_lock;
struct ast_named_lock *__ast_named_lock_get(const char *filename, int lineno, const char *func,
enum ast_named_lock_type lock_type, const char *keyspace, const char *key);
-int __ast_named_lock_put(const char *filename, int lineno, const char *func,
- struct ast_named_lock *lock);
-
/*!
* \brief Geta named lock handle
* \since 13.9.0
@@ -92,11 +89,8 @@ int __ast_named_lock_put(const char *filename, int lineno, const char *func,
* \since 13.9.0
*
* \param lock The pointer to the ast_named_lock structure returned by ast_named_lock_get
- * \retval 0 Success
- * \retval -1 Failure
*/
-#define ast_named_lock_put(lock) \
- __ast_named_lock_put(__FILE__, __LINE__, __PRETTY_FUNCTION__, lock)
+#define ast_named_lock_put(lock) ao2_cleanup(lock)
/*!
* @}