-
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
Wrap pthread objects #9067
Wrap pthread objects #9067
Conversation
Related: #6993 |
I missed a few spots, fixing that now. |
14e5be7
to
51db390
Compare
Rebased to fix a conflict with #9069. |
Done, ready for review! |
wrt lock.hh: Is |
Yeah, I was looking at the same thing. I think it should go, the idea was nice but we never used it and IMHO this is an optimization best left to the implementation.
It's gone :) |
I just removed |
I looked at making the constructors taking a |
Nice idea, I like it! |
This is to avoid re-introducing code using the unwrapped pthread_rwlock_t's. While there, reorganize the classes to make the order more natural.
537d6d4
to
4a490a3
Compare
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.
Love how this makes all kinds of errors less likely to occur.
Short description
This PR wraps the remaining
pthread_*
objects in our code base:pthread_mutex_t
->std::mutex
(always correctly initialized, can't be copied, properly destroyed via RAII) ;pthread_rwlock_t
->ReadWriteLock
(light wrapper, always correctly initialized, can't be copied, properly destroyed via RAII) ;pthread_create
->std::thread
(no need of an awkward wrapper to pass the parameters, easier to join or detach).Checklist
I have: