summaryrefslogtreecommitdiff
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2010-12-20 18:03:09 +0000
committerDavid Vossel <dvossel@digium.com>2010-12-20 18:03:09 +0000
commit7bdd60d6f08d28615895ce70b60bd5a39d3f4883 (patch)
tree079931f69eae1bafb264a1517f529bcb9462809c /main/astobj2.c
parent9ae2d8024df9dde965384b7df073a9f483c4d1bb (diff)
New astobj2 flag for issuing a callback without locking the container.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@299135 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 50886de2e..bdd70c63e 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -654,7 +654,10 @@ static void *internal_ao2_callback(struct ao2_container *c,
last = i + 1;
}
- ao2_lock(c); /* avoid modifications to the content */
+
+ if (!(flags & OBJ_NOLOCK)) {
+ ao2_lock(c); /* avoid modifications to the content */
+ }
for (; i < last ; i++) {
/* scan the list with prev-cur pointers */
@@ -738,7 +741,10 @@ static void *internal_ao2_callback(struct ao2_container *c,
last = start;
}
}
- ao2_unlock(c);
+
+ if (!(flags & OBJ_NOLOCK)) {
+ ao2_unlock(c);
+ }
/* if multi_container was created, we are returning multiple objects */
if (multi_container != NULL) {