task_period_stop() is used to close a timer explicitly, to avoid
the timer handle closed again by task_stop(), we should reset its
value after close.
Also add value-reset for info->id for safe.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
if (info->id > 0) {
pthread_cancel(info->id);
pthread_join(info->id, NULL);
+ info->id = -1;
}
- if (info->periodic.timer_fd)
+ if (info->periodic.timer_fd) {
close(info->periodic.timer_fd);
+ info->periodic.timer_fd = 0;
+ }
if (info->postfn)
info->postfn(info->private_data);
if (info->periodic.timer_fd) {
timerfd_settime(info->periodic.timer_fd, 0, NULL, NULL);
close(info->periodic.timer_fd);
+ info->periodic.timer_fd = -1;
}
}