diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2024-01-17 11:29:46 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2024-02-01 16:35:10 +0200 |
commit | 810928383f33680cfb93504a55c20a214ce5ef4f (patch) | |
tree | 879fcb5f67d144cc10404fc2d85bd2ee95edda76 | |
parent | 5cc40ab1c038831d9d9fafa97a6b6222d8141432 (diff) |
linux-gen: sched: avoid odp_time_cmp() in schedule_loop_sleep()
Reorganize some conditionals in schedule_loop_sleep() in order to make
them clearer, and to avoid calling odp_time_cmp() needlessly in some
situations.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
-rw-r--r-- | platform/linux-generic/odp_schedule_basic.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 3b0a4dce9..379f1f828 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -1698,16 +1698,13 @@ static inline int schedule_loop_sleep(odp_queue_t *out_queue, uint64_t wait, nanosleep(&ts, NULL); } - if (wait != ODP_SCHED_WAIT || !sleep) { + if (!sleep || wait != ODP_SCHED_WAIT) current = odp_time_local(); - if (odp_time_cmp(start_sleep, current) < 0) - sleep = 1; - } - if (wait == ODP_SCHED_WAIT) - continue; + if (!sleep && odp_time_cmp(start_sleep, current) < 0) + sleep = 1; - if (odp_time_cmp(end, current) < 0) + if (wait != ODP_SCHED_WAIT && odp_time_cmp(end, current) < 0) break; } |