Skip to content
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 IceUtil::Mutex with std::mutex #1755

Merged
merged 3 commits into from
Feb 5, 2024
Merged

Conversation

pepone
Copy link
Member

@pepone pepone commented Feb 5, 2024

This is a first pass on replacing IceUtil::Mutex by std::mutex

Copy link
Member

@bernardnormier bernardnormier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

#include <Ice/UserExceptionFactory.h>
#include <Ice/ValueFactory.h>

#include <mutex>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have blank line between include and namespace.

Copy link
Member

@externl externl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! See comments.

{
wait();
}
_conditionVariable.wait(lock, [this]{ return _state >= StateNotValidated; });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the equality check correct?

Suggested change
_conditionVariable.wait(lock, [this]{ return _state >= StateNotValidated; });
_conditionVariable.wait(lock, [this]{ return _state > StateNotValidated; });

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@@ -1256,7 +1256,7 @@ class BluetoothService : public DBus::Filter, public std::enable_shared_from_thi
ConnectCallbackPtr _cb;
};

IceUtil::Monitor<IceUtil::Mutex> _lock;
std::mutex _lock;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to _mutex?

Actually staring at the code, you're locking _mutex which used to be _lock. A bug? Am I missing something?

@pepone pepone merged commit 7415fd6 into zeroc-ice:main Feb 5, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants