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

platform: add CriticalSectionLock #4962

Merged
merged 1 commit into from Sep 4, 2017

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Aug 23, 2017

Critical section class RAII addition

I realized we dont have it here, and often used C API. This file is based on the class we used to have in core-util module (same thing, no changes, just different location).

cc @pan- @sg- @c1728p9 @bulislaw

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

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

Does it make sense to wrap it in NonCopyable?

@bulislaw
Copy link
Member

We could have simple test for that (and C version) ;) Could you add a ticket to IOTMORF-1036?

@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 23, 2017

We could have simple test for that (and C version) ;) Could you add a ticket to IOTMORF-1036?

Created

@pan-
Copy link
Member

pan- commented Aug 24, 2017

@bulislaw Would be better if the class was marked as non copyable.

@0xc0170 It might be interesting to add a lock and unlock member function to allows user code to lock and unlock if needed in the middle of an algorithm:

CriticalSectionLock cs_lock;

// part of the algorithm needing the lock. 
// For example finding a value in a shared data structure 

cs_lock.unlock();

// part of the algorithm that can run without the lock
// For example computing a value from the data found.

cs_lock.lock();

// part of the algorithm needing the lock. 
// For example finding adding the result in a shared data structure

Critical section class RAII addition
@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 29, 2017

@pan- Updated

@studavekar
Copy link
Contributor

/morph test

@mbed-bot
Copy link

mbed-bot commented Sep 3, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1184

All builds and test passed!

@0xc0170 0xc0170 merged commit 4ccff69 into ARMmbed:master Sep 4, 2017
@0xc0170 0xc0170 deleted the dev_critical_section branch September 4, 2017 15:51
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

5 participants