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

Support taskENTER_CRITICAL? #10

Open
srobertjames opened this issue Sep 21, 2023 · 6 comments
Open

Support taskENTER_CRITICAL? #10

srobertjames opened this issue Sep 21, 2023 · 6 comments

Comments

@srobertjames
Copy link

This C++ wrapper looks excellent - a simple wrapper that does exactly that without ruining FreeRTOS or doing more than I ask for.

Do you support taskENTER_CRITICAL https://www.freertos.org/taskENTER_CRITICAL_taskEXIT_CRITICAL.html ? I couldn't find any such methods.

@jonenz
Copy link
Owner

jonenz commented Sep 21, 2023

Yes. It's part of the kernel namespace.

FreeRTOS::Kernel::enterCritical()

@srobertjames
Copy link
Author

Thank you. For my knowledge, why is it there and not part of Task? What is the division between Kernel and Task? (I had expected things that begin with task prefix to be in Task class)

@jonenz
Copy link
Owner

jonenz commented Sep 21, 2023

The idea was to put things in the Task class operate on a specific instance of a task or take TaskHandle_t as an argument to the FreeRTOS function. Things in the Kernel namespace are more generic operations that apply to the entire kernel.

taskENTER_CRITICAL() is really masking interrupts from task context but doesn't have anything to do with a specific instance of a task other than ensuring the current context will continue to execute uninterrupted (up until configMAX_SYSCALL_INTERRUPT_PRIORITY).

taskENTER_CRITICAL_FROM_ISR() is masking interrupts from ISR context and has nothing to do with any tasks.

@jonenz
Copy link
Owner

jonenz commented Sep 21, 2023

Because taskENTER_CRITICAL() is intended to be called from task context, it may make sense to move it to a protected function of the task class by the same logic as delay() (see #2), but it wouldn't make sense to do that for taskENTER_CRITICAL_FROM_ISR() which might be a bit confusing...

@milhead2
Copy link

milhead2 commented Sep 21, 2023 via email

@jonenz
Copy link
Owner

jonenz commented Sep 22, 2023

Do you support the ENTER/EXIT critical with a scope_lock sort of class?

No, but I would be open to adding some of these implementations in another folder.

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

No branches or pull requests

3 participants