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

Error handling windows (CreateFileMapping) #102

Open
DanielHerchenbach opened this issue May 25, 2023 · 1 comment
Open

Error handling windows (CreateFileMapping) #102

DanielHerchenbach opened this issue May 25, 2023 · 1 comment

Comments

@DanielHerchenbach
Copy link

DanielHerchenbach commented May 25, 2023

Hello,
thank you for this library, I found it helpful!
A minor issue, the handle in this line:
https://github.com/mandreyel/mio/blob/8b6b7d878c89e81614d05edca7936de41ccdd2da/single_include/mio/mio.hpp#L928
should be compared with nullptr to detect the error case in my opinion.
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga#return-value

@DanielHerchenbach
Copy link
Author

This bit me when I tried to mmap an empty file. It surprised me that the underlying APIs of the OS usually treat this as an error. Maybe handle this special case internally or leave a comment somewhere in the documentation?

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

No branches or pull requests

1 participant