btrfs-progs: Move close timer handle code to line after sub process exit
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 27 Jul 2015 12:24:27 +0000 (20:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 31 Aug 2015 17:25:10 +0000 (19:25 +0200)
The timer handle have possibility in using by sub thread,
better to close it after sub process exit.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
task-utils.c

index 0390a69..17fd573 100644 (file)
@@ -61,14 +61,14 @@ void task_stop(struct task_info *info)
        if (!info)
                return;
 
-       if (info->periodic.timer_fd)
-               close(info->periodic.timer_fd);
-
        if (info->id > 0) {
                pthread_cancel(info->id);
                pthread_join(info->id, NULL);
        }
 
+       if (info->periodic.timer_fd)
+               close(info->periodic.timer_fd);
+
        if (info->postfn)
                info->postfn(info->private_data);
 }