FreeRTOS-Cpp icon indicating copy to clipboard operation
FreeRTOS-Cpp copied to clipboard

Support taskENTER_CRITICAL?

Open srobertjames opened this issue 2 years ago • 6 comments

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.

srobertjames avatar Sep 21 '23 15:09 srobertjames

Yes. It's part of the kernel namespace.

FreeRTOS::Kernel::enterCritical()

jonenz avatar Sep 21 '23 15:09 jonenz

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)

srobertjames avatar Sep 21 '23 16:09 srobertjames

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 avatar Sep 21 '23 16:09 jonenz

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 https://github.com/jonenz/FreeRTOS-Cpp/discussions/2), but it wouldn't make sense to do that for taskENTER_CRITICAL_FROM_ISR() which might be a bit confusing...

jonenz avatar Sep 21 '23 16:09 jonenz

Hi John,

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

Mil


From: Jon Enz @.> Sent: Thursday, September 21, 2023 9:15 AM To: jonenz/FreeRTOS-Cpp @.> Cc: Subscribed @.***> Subject: Re: [jonenz/FreeRTOS-Cpp] Support taskENTER_CRITICAL? (Issue #10)

External Email Think Before You Click.

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 #2https://github.com/jonenz/FreeRTOS-Cpp/discussions/2), but it wouldn't make sense to do that for taskENTER_CRITICAL_FROM_ISR() which might be a bit confusing...

— Reply to this email directly, view it on GitHubhttps://github.com/jonenz/FreeRTOS-Cpp/issues/10#issuecomment-1729895295, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEWRWU5O4JVC5L7U5TGPB63X3RR37ANCNFSM6AAAAAA5BWPJ5Q. You are receiving this because you are subscribed to this thread.Message ID: @.***>

CONFIDENTIAL: The information contained in this email communication is confidential information intended only for the use of the addressee. Unauthorized use, disclosure or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return email and destroy all copies of this communication, including all attachments.

milhead2 avatar Sep 21 '23 17:09 milhead2

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.

jonenz avatar Sep 22 '23 13:09 jonenz