summaryrefslogtreecommitdiff
path: root/task-utils.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-07-27 20:24:27 +0800
committerDavid Sterba <dsterba@suse.com>2015-08-31 19:25:10 +0200
commitc3b69e59fc4e165bdabea130905e9b9525dfaeba (patch)
tree0dcb3013963d0c08008919cb24304a994556d27f /task-utils.c
parent73e211a7a8ff3d2395783daaed71bf3792bd753f (diff)
btrfs-progs: Move close timer handle code to line after sub process exit
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>
Diffstat (limited to 'task-utils.c')
-rw-r--r--task-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/task-utils.c b/task-utils.c
index 0390a69f..17fd5736 100644
--- a/task-utils.c
+++ b/task-utils.c
@@ -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);
}