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

Fix nodiscard warnings in sync client #407

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

dberlin
Copy link
Contributor

@dberlin dberlin commented Aug 30, 2022

In later C++ versions, std::async is marked nodiscard. See https://cplusplus.github.io/LWG/issue2856.
The code is correct in that it is properly blocking for the result, but it will now warn since this is considered "not the way".
Adding .wait() to the end of the calls, which explicitly waits on the future, should be the correct fix.

Fixes issue #340

In later C++ versions, std::async is marked nodiscard. See https://cplusplus.github.io/LWG/issue2856.
The code is correct in that it is properly blocking for the result, but it will now warn since this is considered "not the way".
Adding .wait() to the end of the calls, which explicitly waits on the future, should be the correct fix.

Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
@dberlin
Copy link
Contributor Author

dberlin commented Aug 30, 2022

(ECA should now be signed)

@fpagliughi
Copy link
Contributor

Oh, sorry to take so long on this. I haven't updated this library in ages. But, yes, this looks like a bad bug. I'll get it in for the next release.

@fpagliughi fpagliughi merged commit 6bfe507 into eclipse-paho:master Jun 26, 2023
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.

2 participants