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.
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
NameResolutionPal.Unix enabled async name resolution #34633
NameResolutionPal.Unix enabled async name resolution #34633
Changes from 6 commits
fc09ca1
8c955bc
cf13c70
4614267
1b2daab
b9629e9
6f64c86
e7df0cc
d7cb2be
74b3031
775ff72
ec8522f
298cf03
458579b
8f69164
8cec5fb
f3ebd6a
cf45cc9
43f889f
bd16c74
ed5c39f
b8efde5
04dbd8e
37e4dd3
7176378
b64867b
900834e
198717e
f85c316
438c75a
89c266f
33da8da
fa9c6f9
8266dd3
75e52c7
89a7c5a
dd1e245
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why is the fence necessary?
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.
This callback comes in on another thread. It ensures visibility to this thread of everything in
state
.getaddrinfo_a
probably does something like this already, so it might be safe to remove, but it isn't documented.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.
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 had the
free(state)
intentionally before calling the callback.entry
is passed from managed to native and via callback back to managed -- so the position offree(state)
doesn't change anythingstate
won't be freed an so this can be a memory leak -- althoughProcessResult
on the managed side (the "callback worker") has atry-finally
I prefer leaving the
free(state)
before the callback. When there is a good reason to move it after the callback, I'll do it for sure.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.
Both are equivalent, yes, but the suggested change is slightly shorter (and doesn't have a variable that's attributed to but never read from, which is cleaner).
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.
OK.
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.
(It's just a suggestion, no need to change it at all.)
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.
Yeah, but I like it as the code looks cleaner.
Anyway I highly appreciate the feedback here! (My C is a bit rusty, so it's good to get some hints.)
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.
Since the parameter to
getaddrinfo()
is constant, this could be defined statically and the address passed like that everywhere where it's needed: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.
Is there a way to avoid this P/Invoke every time?
Also, since cmakedefine01 is used, maybe this could be rewritten as:
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.
It's cached on the managed side.
Nice trick to return the define. I didn't think about that. Thx.
Will address the other points tomorrow.
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.
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.