-
Notifications
You must be signed in to change notification settings - Fork 866
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
[core] Add a shared mutex class #2981
Conversation
|
|
||
Mutex m_Mutex; | ||
int m_iCountRead; | ||
bool m_bWriterLocked; |
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.
These two fields can be combined into one field. Please see /usr/include/c++/v1/shared_mutex
.
Would be also nice that you use exactly the same public API as the standard one so that a prospective drop-in replacement with the standard one from C++17 can be done later.
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 thought about merging those two fields. I however felt that it would hurt readibility for a negligible memory and performance gain.
API has been changed to match the standard one
Improved syntax Changed lock/unlock functions name to match reference implementation Add unit tests for SharedMutex
@yomnes0 |
Add a shared mutex class