Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sched: add task repetition functionality #279

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

wipawel
Copy link
Contributor

@wipawel wipawel commented Jul 21, 2023

By default tasks run once and get destroyed. It might be useful to run them in an infinite loop (task done -> task scheduled -> ...) in order to achieve tasks interleaving (multiple tasks scheduled on the same CPU).
It might be also useful to set an arbitrary value of repetitions for a given task.

This commit adds simple set_task_repeat() and set_task_loop() API to allow task repetitions.

Example use:

task_t *task1, *task2;

task1 = new_user_task("task1", func1, NULL);
task2 = new_kernel_task("task2", func2, NULL);

set_task_repeat(task1, 2); // Or: set_task_loop(task1);
schedule_task(task1, get_cpu(1));

set_task_repeat(task2, 2); // Or: set_task_loop(task2);
schedule_task(task2, get_cpu(1));

@wipawel wipawel added the improvement A small enhancement, that makes already implemented features better label Jul 21, 2023
@wipawel wipawel requested a review from a team as a code owner July 21, 2023 12:55
common/sched.c Outdated Show resolved Hide resolved
By default tasks run once and get destroyed. It might be useful to run
them in an infinite loop (task done -> task scheduled -> ...) in order
to achieve tasks interleaving (multiple tasks scheduled on the same
CPU).
It might be also useful to set an arbitrary value of repetitions for a
given task.

This commit adds simple set_task_repeat() and set_task_loop() API to
allow task repetitions.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
@wipawel wipawel enabled auto-merge (rebase) July 25, 2023 09:13
@wipawel wipawel merged commit 810ad44 into KernelTestFramework:mainline Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A small enhancement, that makes already implemented features better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants