projects
/
platform
/
upstream
/
btrfs-progs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
btrfs-progs: tests: add shell quoting to fuzz test scripts
[platform/upstream/btrfs-progs.git]
/
task-utils.c
diff --git
a/task-utils.c
b/task-utils.c
index
768be94
..
12b0002
100644
(file)
--- 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->private_data);
if (ret)
- info->id =
-1
;
+ info->id =
0
;
return ret;
}
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);
if (info->id > 0) {
pthread_cancel(info->id);
pthread_join(info->id, NULL);
- info->id =
-1
;
+ info->id =
0
;
}
if (info->periodic.timer_fd) {
}
if (info->periodic.timer_fd) {
@@
-94,8
+94,10
@@
int task_period_start(struct task_info *info, unsigned int period_ms)
return -1;
info->periodic.timer_fd = timerfd_create(CLOCK_MONOTONIC, 0);
return -1;
info->periodic.timer_fd = timerfd_create(CLOCK_MONOTONIC, 0);
- if (info->periodic.timer_fd == -1)
+ if (info->periodic.timer_fd == -1) {
+ info->periodic.timer_fd = 0;
return info->periodic.timer_fd;
return info->periodic.timer_fd;
+ }
info->periodic.wakeups_missed = 0;
info->periodic.wakeups_missed = 0;
@@
-117,6
+119,9
@@
void task_period_wait(struct task_info *info)
if (!info)
return;
if (!info)
return;
+ if (info->periodic.timer_fd == 0)
+ return;
+
ret = read(info->periodic.timer_fd, &missed, sizeof (missed));
if (ret == -1)
return;
ret = read(info->periodic.timer_fd, &missed, sizeof (missed));
if (ret == -1)
return;