-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[libc] Replace MutexLock
with cpp::lock_guard
#89340
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
@nickdesaulniers Please take a look whenever you find time and let me know if I need to make any changes. Also should I leave a comment in the new mutex.h as sort of a "bibliography" that I used the GCC implementation as inspiration? Thanks for your time and your advice earlier on how to tackle this issue! |
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.
Also should I leave a comment in the new mutex.h as sort of a "bibliography" that I used the GCC implementation as inspiration?
If you put it in the commit description in the UI on github, then it will be retained when we squash+merge. Do you mean libstdc++, or GCC? Also, it's important that you didn't copy+paste the implementation. Using it for reference is very much in the spirit of Free Software though.
Thanks for your time and your advice earlier on how to tackle this issue!
You're a pro! Good job and thank you!
I used this to essentially make sure my lock_guard implementation provides the same functionality. However, no copy-pasting was done in any of my code. |
Yeah, then it's fine to mention in the PR description that you were inspired by libstdc++'s implementation. |
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'm very happy with the result here! Two minor style nits, then this LGTM.
Done and done! |
@nickdesaulniers @gchatelet Friendly ping. |
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.
Just a little nit, otherwise LGTM.
Can you land this PR or do you need me to land it?
Addressed your comment :) |
Thx for your contribution @vmishelcs ! 🙏 |
This PR address issue #89002.
Changes in this PR
cpp::lock_guard
(an equivalent ofstd::lock_guard
) in libc/src/__support/CPP inspired by the libstdc++ implementationcpp::lock_guard
in /libc/test/src/__support/CPP/mutex_test.cppMutexLock
withcpp::lock_guard