X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=task-utils.c;h=12b00027a2bae479f130252b501cd1dfd5104727;hb=feccd7a8180f3f0f48ca23692ad5f71783163450;hp=58f51950914836c6dc5d2a6259205cdba0679048;hpb=cb3424cd23c4c682063d1aa89347fec0736d9c4d;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/task-utils.c b/task-utils.c index 58f5195..12b0002 100644 --- a/task-utils.c +++ b/task-utils.c @@ -51,7 +51,7 @@ int task_start(struct task_info *info) info->private_data); if (ret) - info->id = -1; + info->id = 0; return ret; } @@ -64,7 +64,7 @@ void task_stop(struct task_info *info) if (info->id > 0) { pthread_cancel(info->id); pthread_join(info->id, NULL); - info->id = -1; + info->id = 0; } if (info->periodic.timer_fd) { @@ -119,6 +119,9 @@ void task_period_wait(struct task_info *info) if (!info) return; + if (info->periodic.timer_fd == 0) + return; + ret = read(info->periodic.timer_fd, &missed, sizeof (missed)); if (ret == -1) return;