-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[libs] Fix poll events conversion #86843
Conversation
trungnt2910
commented
May 28, 2023
- Use bitwise and to check for all flags instead of using a switch statement for poll events flags conversion.
- Convert poll events before comparison in assert statement.
a73fbb1
to
4d2573a
Compare
Why? |
The problem does not appear on Linux or other UNIXes as they use the same values as the However, there don't seem to be any standard mandating the underlying values of these flags, and on Haiku these flags have different values. Because there are no standards for the values, I don't think it is correct to assume the values are the same for the PAL and the underlying platform. As this change affects cross-platform code I decided to open a PR separate from my Haiku-specific changes. |
I'm not understanding. The whole purpose of these methods is to map between the PAL values and the OS values which may not match. You're saying your new version works and the existing ones fail? |
Unless there is something I am missing, the existing code has two issues:
runtime/src/native/libs/Common/pal_io_common.h Lines 107 to 132 in 5b8437d
When a set containing two or more flags is passed (for example, The same applies to the reverse mapping: runtime/src/native/libs/Common/pal_io_common.h Lines 157 to 182 in 5b8437d
The assert seems to have meant to ensure that the Neither of these issues are visible on Linux and some other UNIXes since the PAL flags and the OS flags are the same (probably the flags were chosen to match Linux and other platforms all coincidentally have the same flags?). The On Haiku, or any other platforms with a different representation of the |
4d2573a
to
9ce80b0
Compare
Tagging subscribers to this area: @dotnet/area-system-io Issue Details
|
Tagging subscribers to this area: @dotnet/ncl Issue Details
|
- Use bitwise and to check for all flags instead of using a switch statement for poll events flags conversion. - Convert poll events before comparison in assert statement.
9ce80b0
to
095615b
Compare
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.
LGTM