mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 03:04:19 +00:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
/*!
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user