Skip to content

Critical Section doc update #298

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

Merged
merged 7 commits into from
Oct 30, 2017
Merged

Critical Section doc update #298

merged 7 commits into from
Oct 30, 2017

Conversation

deepikabhavnani
Copy link

Added an example to demonstrate race condition and usage of critical section api. Also updated the description for API.

https://jira.arm.com/browse/IOTMORF-1286

@AnotherButler @sg- Please review

@AnotherButler
Copy link
Contributor

@deepikabhavnani Please review my copy edits, and make sure they didn't accidentally change the meaning of anything.

Make copy edits, mostly for active voice and formatting.
@deepikabhavnani
Copy link
Author

@AnotherButler - Looks good, will try not to repeat same :-)

deepikabhavnani and others added 2 commits October 23, 2017 16:20
Combine and capitalize parts of word because we're talking about the API here.
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

A few comments.

@@ -1,3 +1,15 @@
## CriticalSectionLock

CriticalSectionLock class provides a mechanism to access a resource uniterrupted. With the `lock` API, you can enter critical section with interrupts disabled. The `unlock` API is the exit from critical section, and the state of interrupts is restored upon exit. Nesting of critical section is supported, and interrupts are enabled only when we exit from last nested critical section.
Copy link
Contributor

Choose a reason for hiding this comment

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

uninterrupted or without interruption? Anything about RAII usage or scope?

@c1728p9 c1728p9 mentioned this pull request Oct 28, 2017
@@ -1,3 +1,18 @@
## CriticalSectionLock

CriticalSectionLock class provides a mechanism to access a resource without interruption. With the `lock` API, you can enter critical section with interrupts disabled. The `unlock` API is the exit from critical section, and the state of interrupts is restored upon exit. Nesting of critical section is supported, and interrupts are enabled only when we exit from last nested critical section.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to remove mentions the lock and unlock since these aren't RAII and may be deprecated?

Copy link
Author

Choose a reason for hiding this comment

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

I will keep them in 5.6 version as they are relevant. Hopefully we would deprecate by 5.7

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good

Make minor copy edits.
Copy link
Contributor

@AnotherButler AnotherButler left a comment

Choose a reason for hiding this comment

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

I have a few comments related to passive voice and clarity. Please review my suggested changes and answer my questions.

@@ -1,3 +1,17 @@
## CriticalSectionLock

The CriticalSectionLock class provides a mechanism to access a resource without interruption. With the `lock` API, you can enter critical section with interrupts disabled. The `unlock` API is the exit from critical section, and the state of interrupts is restored upon exit. Nesting of critical section is supported, and interrupts are enabled only when we exit from last nested critical section.
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Who or what restores the state of interrupts upon exist? Also, who or what enables interrupts only when we exist from the last critical section?

Copy link
Author

Choose a reason for hiding this comment

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

Destructor - restores the state of interrupts/
Destructor

@@ -1,3 +1,17 @@
## CriticalSectionLock

The CriticalSectionLock class provides a mechanism to access a resource without interruption. With the `lock` API, you can enter critical section with interrupts disabled. The `unlock` API is the exit from critical section, and the state of interrupts is restored upon exit. Nesting of critical section is supported, and interrupts are enabled only when we exit from last nested critical section.

CriticalSectionLock class is based on RAII approach. In other words, lock is acquired in constructor and destroyed automatically when out of scope as part of destructor. We do not recommend you use CriticalSectionLock as global or a member of a class because you will enter critical section on object creation, and all interrupts will be disabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Who or what acquires lock in the constructor? Also, who or what destroys lock automatically when it's out of scope? Also, who or what disables all interrupts when you use CriticalSectionLock as global or a member of a class?

Copy link
Author

Choose a reason for hiding this comment

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

Constructor acquires the lock. Destructor destroys lock.

Make minor changes from passive to active voice.
@AnotherButler
Copy link
Contributor

@deepikabhavnani Please review my changes and make sure I didn't accidentally change the meaning of anything.

Copy link
Author

@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. Thanks for changes.

@AnotherButler AnotherButler merged commit 28eaaed into ARMmbed:new_engine Oct 30, 2017
@deepikabhavnani deepikabhavnani deleted the CriticalSectionLock branch October 30, 2017 19:43
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

Successfully merging this pull request may close these issues.

5 participants