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

feat(driver,windows): add win32 event support #223

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

Berrysoft
Copy link
Member

This PR adds Win32 event support for IOCP driver. Win32 event is kind of foundamental syncronize object. It could be, e.g., an event handle, an input console handle, a pipe handle, or a mutex handle.

Win32 event could not be polled by IOCP, but IOCP could be waited as a usual event on Windows 10+. MsgWaitForMultipleObjectsEx is used here to wait them all, and reserves possibility for APC routines and window messages. If there are more than 62 events to be waited, the remain events will be waited in seperate threads.

In this PR, stdio is also refactored to use the new feature. To make the code simpler, the console code page is forced to UTF8.

This PR is a prediction of the planned compio-process. We need the feature to wait for the process handle.

@Berrysoft Berrysoft added enhancement New feature or request driver: IOCP About the IOCP driver labels Mar 7, 2024
@Berrysoft Berrysoft self-assigned this Mar 7, 2024
@Berrysoft Berrysoft added the package: driver Related to compio-driver label Mar 7, 2024
@Berrysoft
Copy link
Member Author

Berrysoft commented Mar 7, 2024

@George-Miao may feel hard to review code for Windows. @bdbai would you like to take a look?

@Berrysoft Berrysoft marked this pull request as draft March 7, 2024 18:37
@Berrysoft Berrysoft marked this pull request as ready for review March 8, 2024 09:09
@Berrysoft
Copy link
Member Author

Impl changed to use thread pool API instead. According to Raymond Chen, it handles more than 64 events in a single thread.

@Berrysoft Berrysoft requested review from bdbai and removed request for George-Miao March 8, 2024 09:11
@Berrysoft Berrysoft merged commit 7fbd340 into compio-rs:master Mar 8, 2024
29 checks passed
@Berrysoft Berrysoft deleted the dev/win32-event branch March 8, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
driver: IOCP About the IOCP driver enhancement New feature or request package: driver Related to compio-driver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants