-
Notifications
You must be signed in to change notification settings - Fork 117
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
update guard condition by managing multiple items #527
update guard condition by managing multiple items #527
Conversation
32c5c09
to
4e4ab1b
Compare
…ables Signed-off-by: Chen Lihui <[email protected]>
4e4ab1b
to
33ea304
Compare
@@ -80,8 +82,8 @@ class GuardCondition | |||
private: | |||
std::mutex internalMutex_; | |||
std::atomic_bool hasTriggered_; | |||
std::mutex * conditionMutex_ RCPPUTILS_TSA_GUARDED_BY(internalMutex_); | |||
std::condition_variable * conditionVariable_ RCPPUTILS_TSA_GUARDED_BY(internalMutex_); | |||
std::list<std::pair<std::mutex *, std::condition_variable *>> conditions_ |
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 think we should make this a std::vector
? The most common operations (in my opinion) will be trigger()
which has to loop over this sequence of pairs. If removing a pair is expensive (inside of detachCondition()
), I don't think that's as important.
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.
Thank you, I'll update it.
I noted this From the comments behind, I think running this CI is intent to use expected because of using
|
Co-authored-by: William Woodall <[email protected]> Signed-off-by: Chen Lihui <[email protected]>
// TODO(iuhilnehc-ynos): conditionMutex is not used, remove it | ||
std::unique_lock<std::mutex> clock(*cond.first); | ||
clock.unlock(); |
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.
Quick question, are these actually needed? just curious why not removing now?
not a correct fix, close it |
related to ros2/rclcpp#1611
Signed-off-by: Chen Lihui [email protected]