[Proxying][Docs] Improve the docs for proxying with callback - #18359
Merged
Conversation
The tests in test_pthread_proxying_cpp proxy functions that increment local variables. For the async proxying functions, the proxying is followed by a wait on a condition variable so the test can assert that the proxied work was completed. However, the incrementing of the local variables was not protected by the lock used with the condition variable, so it was possible for the variable to be incremented and the condition variable notified after checking the wait condition but before waiting. Since the condition variable would not be notified again, the test would wait on the condition variable forever. Fix the bug by taking the lock before incrementing the variable in tests where this could cause problems. Fixes #18353.
Make it clear that work is asynchronously proxied in both directions and that the return code is determined only by whether the initial work is proxied.
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Member
|
What happens if it fails the second enqueue operation? Is it silently dropped or do we abort? |
Member
Author
|
It's silently dropped, but the only way that can happen is if there is an allocation failure, and those are typically assumed not to happen in practice. I suppose we could abort instead. Do you think that would be better? |
Member
|
I think aborting is better, though I could see a case for removing that check in a no-assertions build. Might be worth documenting that either way. Was that already an issue with the previous proxying commands? |
kripken
approved these changes
Dec 13, 2022
kripken
left a comment
Member
There was a problem hiding this comment.
Either way lgtm, thanks, this PR is a good improvement.
sbc100
reviewed
Dec 13, 2022
| { | ||
| std::unique_lock<std::mutex> lock(mutex); | ||
| i = 3; | ||
| } |
sbc100
approved these changes
Dec 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Make it clear that work is asynchronously proxied in both directions and that
the return code is determined only by whether the initial work is proxied.