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
CriticalSectionLock class improvement #5621
CriticalSectionLock class improvement #5621
Conversation
3fe66fe
to
fa1a7ef
Compare
@tommikas Please can you look at this failure, I found at least one more PR that looks like a network failure (this should not cause it as it does not change any code behavior). |
Guys What do you think about adding
|
fa1a7ef
to
18ee38f
Compare
If HAL defines it (this however is in progress, so this can be added once critical section improvements get in, as an extension , or?) then it would be good to have. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
platform/CriticalSectionLock.h
Outdated
*/ | ||
MBED_DEPRECATED_SINCE("mbed-os-5.7", | ||
"This function is inconsistent with RAII and is being removed in the future.") | ||
void lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Sam has concerns about deprecating this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I remember Sam had concerns about deprecating whole class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me aside from Sam's concerns about the deprecation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecation of lock/unlock is ok with replacement by static enable/disable members. make sure the note specifies how to use this
18ee38f
to
b38f3f1
Compare
98db4e5
to
7c7a046
Compare
requested changes applied @sg- |
platform/CriticalSectionLock.h
Outdated
@@ -33,14 +33,25 @@ namespace mbed { | |||
* Usage: | |||
* @code | |||
* | |||
* void f() { | |||
* // RAII style usage | |||
* void foo() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make this a real example, not foo and bar, etc
platform/CriticalSectionLock.h
Outdated
* // some code here | ||
* { | ||
* CriticalSectionLock lock; | ||
* // Code in this block will run with interrupts disabled | ||
* } | ||
* // interrupts will be restored to their previous state | ||
* } | ||
* | ||
* // free locking usage | ||
* void bar() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make this a real example, not foo and bar, etc
platform/CriticalSectionLock.h
Outdated
*/ | ||
MBED_DEPRECATED_SINCE("mbed-os-5.8", | ||
"This function is inconsistent with RAII and is being removed in the future.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecated note should have the name syntax of what replaces it. Something like
platform/CriticalSectionLock.h
Outdated
*/ | ||
MBED_DEPRECATED_SINCE("mbed-os-5.8", | ||
"This function is inconsistent with RAII and is being removed in the future.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecated note should have the name syntax of what replaces it. Something like
7c7a046
to
8091d49
Compare
@sg- requested changes added |
8aecfbd
to
a9a20e8
Compare
/morph build |
Build : SUCCESSBuild number : 753 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 405 |
Test : FAILUREBuild number : 577 |
@0xc0170
|
a9a20e8
to
ad67904
Compare
/morph build |
Build : SUCCESSBuild number : 764 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 419 |
Test : SUCCESSBuild number : 594 |
Description
Change CriticalSectionLock member functions
void lock/unlock()
to static onesstatic void lock/unlock()
to allow more meaningfullock
/unlock
usageStatus
READY
Migrations
Although the class API is changed, usage is not affected since class member access syntax is allowed for static functions
YES
Related PRs
#5420