-
Notifications
You must be signed in to change notification settings - Fork 921
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
Replace pthread_rwlock with std::shared_mutex #10216
Conversation
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.
What I always found confusing: to declare a lock object you use ReadWriteLock
, but to take a lock is ReadLock
or WriteLock
. I'd love to rename the latter to TakeReadLock
and TakeWriteLock
. Or maybe Acquire...
?
Alternatively we could rename ReadWriteLock
to ReadWriteLockObject
.
That feels like a different pull request to me but sure, feel free to do so. |
Yes, that would be a change in interface while this PR only concerns implementation. I agree a separate PR is better for that part. |
I'll test soon to see if linux/clang has the same performance regression as OpenBSD/clang (about 2x slower). |
Perhaps |
I think it is clear OpenBSD is the outlier. On buster using clang-7 using a random laptop with an Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz master
PR:
So here the PR is better. To compare, I also checked with clang-8:
PR:
And gcc8.3: master:
PR:
|
I'm merging this PR, we will rename the |
Short description
Closes #10209.
The speed tests result looks good, except perhaps for a small regression in the "RW lock shared" case but since we are talking of 1 usec for 1000 operations, I believe we can live with that.
Checklist
I have: