]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
astobj2: Comment on OBJ_NOLOCK in ao2_container_clone.
authorCorey Farrell <git@cfware.com>
Tue, 2 Oct 2018 22:15:47 +0000 (18:15 -0400)
committerCorey Farrell <git@cfware.com>
Wed, 3 Oct 2018 16:03:36 +0000 (11:03 -0500)
The test for OBJ_NOLOCK looks wrong but it isn't.  Add comments to
prevent confusion.

Change-Id: I9662b82eb39e7627a1f1944fd18f967a2b987344

main/astobj2_container.c

index 9bea58f74d9c15c207de127d1b31523e0f191c17..51978674e11b7159a39b7bbe15cd10fa821be1cf 100644 (file)
@@ -718,6 +718,9 @@ struct ao2_container *__ao2_container_clone(struct ao2_container *orig, enum sea
                return NULL;
        }
 
+       /* This test is correct.  clone must be locked before calling
+        * ao2_container_dup when the OBJ_NOLOCK flag is set, otherwise
+        * we could have errors in __adjust_lock. */
        if (flags & OBJ_NOLOCK) {
                ao2_wrlock(clone);
        }