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

Feature: Allow RTOS CPU yielding #8

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

tyalie
Copy link

@tyalie tyalie commented Mar 30, 2023

The biggest advantage of using a RTOS (FreeRTOS, Zephyr, …) is their ability to hide the complexity of asynchronous systems, but this often requires cooperation by the threads.

This library makes extensive use of busy waiting when it is being used in blocking mode, which in the way it was implemented broke the cooperation principle. To solve this this patch introduces a function named Mcb_RelinquishCPU to mcb_usr.h.

This function is executed on every iteration in the libraries busy waiting loops. When using an RTOS, the user can override it in order to execute their native thread yield / wait / … functions and allow the OS reschedule the task.

On non RTOS systems this is of course a no-op.

The biggest advantage of using a RTOS (FreeRTOS, Zephyr, …) is their
ability to hide the complexity of asynchronous systems, but this often
requires cooperation by the threads.

This library makes extensive use of busy waiting when it is being used
in blocking mode, which in the way it was implemented broke the
cooperation principle. To solve this this patch introduces a function
named `Mcb_RelinquishCPU` to `mcb_usr.h`.

This function is executed on every iteration in the libraries busy
waiting loops. When using an RTOS, the user can override it in order to
execute their native thread yield / wait / … functions and allow the
OS reschedule the task.

On non RTOS systems this is of course a no-op.

Signed-off-by: Elisabeth Friedrich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant