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

CriticalSectionLock class improvement #5621

Merged
merged 1 commit into from Dec 29, 2017

Conversation

maciejbocianski
Copy link
Contributor

Description

Change CriticalSectionLock member functions void lock/unlock() to static ones
static void lock/unlock() to allow more meaningful lock/unlock usage

Status

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

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 1, 2017

@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).

@maciejbocianski
Copy link
Contributor Author

Guys

What do you think about adding is_locked function to CriticalSection class to cover full core_util_critical_section interface?
(for more details see #5346)

static bool is_locked()
{
    return core_util_in_critical_section();
}

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 4, 2017

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.

Copy link

@deepikabhavnani deepikabhavnani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@c1728p9 c1728p9 requested a review from sg- December 11, 2017 17:46
*/
MBED_DEPRECATED_SINCE("mbed-os-5.7",
"This function is inconsistent with RAII and is being removed in the future.")
void lock()
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@c1728p9 c1728p9 left a 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.

Copy link
Contributor

@sg- sg- left a 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

@maciejbocianski
Copy link
Contributor Author

requested changes applied @sg-

@@ -33,14 +33,25 @@ namespace mbed {
* Usage:
* @code
*
* void f() {
* // RAII style usage
* void foo() {
Copy link
Contributor

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

* // 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() {
Copy link
Contributor

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

*/
MBED_DEPRECATED_SINCE("mbed-os-5.8",
"This function is inconsistent with RAII and is being removed in the future.")
Copy link
Contributor

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

*/
MBED_DEPRECATED_SINCE("mbed-os-5.8",
"This function is inconsistent with RAII and is being removed in the future.")
Copy link
Contributor

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

@maciejbocianski
Copy link
Contributor Author

@sg- requested changes added

@maciejbocianski maciejbocianski force-pushed the critical_section_imp2 branch 2 times, most recently from 8aecfbd to a9a20e8 Compare December 21, 2017 13:37
@0xc0170
Copy link
Contributor

0xc0170 commented Dec 22, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Dec 22, 2017

Build : SUCCESS

Build number : 753
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5621/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Dec 22, 2017

@mbed-ci
Copy link

mbed-ci commented Dec 22, 2017

@maciejbocianski
Copy link
Contributor Author

maciejbocianski commented Dec 22, 2017

@0xc0170
Error log

tests-netsocket-tcp_echo 
Platform: K64F - Toolchain: ARM
[1513954424.89][CONN][RXD] >>> Running case #1: 'TCP echo'... 
[1513954424.89][CONN][INF] found KV pair in stream: {{__testcase_name;TCP echo}}, queued...  
[1513954424.89][CONN][INF] found KV pair in stream: {{__testcase_start;TCP echo}}, queued... 
[1513954426.76][CONN][RXD] Thread 00000000 error -4: Parameter error 
[1513954665.00][HTST][INF] test suite run finished after 240.27 sec...
tests-netsocket-udp_dtls_handshake 
Platform: K64F - Toolchain: ARM
[1513955330.40][CONN][RXD] >>> Running case #1: 'UDP DTLS handshake'... 
[1513955330.48][CONN][INF] found KV pair in stream: {{__testcase_start;UDP DTLS handshake}}, queued... 
[1513955332.17][CONN][RXD] Thread 00000000 error -4: Parameter error 
[1513955450.29][HTST][INF] test suite run finished after 120.05 sec...

@cmonr
Copy link
Contributor

cmonr commented Dec 28, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Dec 28, 2017

Build : SUCCESS

Build number : 764
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5621/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Dec 28, 2017

@mbed-ci
Copy link

mbed-ci commented Dec 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants