]> sourceware.org Git - dm.git/commitdiff
multilog_clear_logging() lock additions
authorHeinz Mauelshagen <heinzm@redhat.com>
Wed, 4 May 2005 14:15:30 +0000 (14:15 +0000)
committerHeinz Mauelshagen <heinzm@redhat.com>
Wed, 4 May 2005 14:15:30 +0000 (14:15 +0000)
multilog/libmultilog.c

index 93ee5de5fcb8f438eaa1a344011918392488954f..7089f4b2c4a51d5534e111870574a467761440b5 100644 (file)
@@ -194,8 +194,22 @@ void multilog_clear_logging(void)
 {
        struct list *tmp, *next;
        struct log_list *logl;
+       struct list ll;
+
+       list_init(&ll);
+
+       /* First step: move elements to temporary local list safely. */
+       lock_mutex();
 
        list_iterate_safe(tmp, next, &logs) {
+               list_del(tmp);
+               list_add(&ll, tmp);
+       }
+
+       unlock_mutex();
+
+       /* Second step: delete them. */
+       list_iterate_safe(tmp, next, &ll) {
                logl = list_item(tmp, struct log_list);
 
                if (logl->data)
This page took 0.024147 seconds and 5 git commands to generate.