Skip to content

Commit

Permalink
linux-gen: sched: avoid odp_time_cmp() in schedule_loop_sleep()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
JereLeppanen committed Jan 17, 2024
1 parent 41da131 commit 7b41c7a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions platform/linux-generic/odp_schedule_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7b41c7a

Please sign in to comment.