-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Decouple ObjectPool from SystemLayer #9329
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
chrisdecenzo,
jelderton,
jmartinez-silabs,
LuDuda,
mspang,
sagar-apple,
saurabhst,
vivien-apple and
woody-apple
August 30, 2021 14:33
yufengwangca
requested review from
jmartinez-silabs,
msandstedt and
yunhanw-google
and removed request for
jmartinez-silabs
August 30, 2021 14:35
andy31415
approved these changes
Aug 30, 2021
yunhanw-google
approved these changes
Aug 30, 2021
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.
besides the above comments, the overall decoupling Looks great! thanks
msandstedt
approved these changes
Aug 31, 2021
woody-apple
approved these changes
Aug 31, 2021
jmartinez-silabs
approved these changes
Aug 31, 2021
Size increase report for "gn_qpg-example-build" from 90c6e96
Full report output
|
Size increase report for "esp32-example-build" from 90c6e96
Full report output
|
Size increase report for "nrfconnect-example-build" from 90c6e96
Full report output
|
mkardous-silabs
pushed a commit
to mkardous-silabs/connectedhomeip
that referenced
this pull request
Sep 24, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
What is being fixed? Examples:
Currently, the ObjectPool is coupled with SystemLayer and only be used by SystemLayer and InetLayer components. The purpose of this coupling is to guarantee the ObjectPool APIs are thread safe by atomically checking if the object has been retained and setting the object to 'retained' on those embedded systems which do not support std::mutex.
__sync_bool_compare_and_swap(&this->mSystemLayer, nullptr, &aLayer))
Actually, we can leverage another existing field mRefCount to do the same check and set atomically. So mSystemLayer can be saved from each Object.
__sync_bool_compare_and_swap(&this->mRefCount, 0, 1)
We could decouple ObjectPool from SystemLayer to make ObjectPool more generic and to be used by higher layers (such as apps) which do not have access to SystemLayer.
Change overview
Decouple ObjectPool from SystemLayer
Testing
How was this tested? (at least one bullet point required)