summaryrefslogtreecommitdiff
path: root/include/asterisk/named_locks.h
AgeCommit message (Collapse)Author
2016-09-02named_locks: Use ao2_weakproxy to deal with cleanup from container.Corey Farrell
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
2016-04-08lock: Add named lock capabilityGeorge Joseph
Locking some objects like sorcery objects can be tricky because the underlying ao2 object may not be the same for all callers. For instance, two threads that call ast_sorcery_retrieve_by_id on the same aor name might actually get 2 different ao2 objects if the underlying wizard had to rehydrate the aor from a database. Locking one ao2 object doesn't have any effect on the other even if those objects had locks in the first place. Named locks allow access control by keyspace and key strings. Now an "aor" named "1000" can be locked and any other thread attempting to lock "aor" "1000" will wait regardless of whether the underlying ao2 object is the same or not. Mutex and rwlocks are supported. This capability will initially be used to lock an aor when multiple threads may be attempting to prune expired contacts from it. Change-Id: If258c0b7f92b02d07243ce70e535821a1ea7fb45