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

Support waitable objects on Windows 10 #25

Closed
Demi-Marie opened this issue May 10, 2020 · 8 comments
Closed

Support waitable objects on Windows 10 #25

Demi-Marie opened this issue May 10, 2020 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@Demi-Marie
Copy link

There is an (undocumented) NtAssociateWaitCompletionPacket syscall that can be used for the purpose.

@ghost
Copy link

ghost commented May 11, 2020

@ghost ghost transferred this issue from smol-rs/smol Sep 5, 2020
@ghost
Copy link

ghost commented Sep 14, 2020

Do you perhaps know of any unofficial documentation on NtAssociateWaitCompletionPacket or maybe even a project using it?

@DemiMarie
Copy link

ProcessHacker has a function prototype but I don’t know of anyone else using it. Fortunately, the argument names should be fairly self-explanatory.

@notgull
Copy link
Member

notgull commented Jul 16, 2022

I'd rather avoid using a system call that's entirely undocumented (this issue is the second result on Google when I look up the function name). Is there a way to work this into wepoll?

@DemiMarie
Copy link

@notgull Maybe? wepoll already uses undocumented Windows internals so this would not be new.

@notgull
Copy link
Member

notgull commented Jul 16, 2022

I'm honestly not a big fan of that either, since it has led to breakages on certain platforms (e.g. Wine) and could very easily break with no warning on future versions of Windows. However at this point the only alternatives are explicitly deprecated (WSAAsyncSelect) or incompatible with the current API (I/O Completion Ports), so I'm unsure as to what it would be replaced with.

What I'm trying to say is that we already rely on enough unstable behavior, and there's no need to build onto that house of cards more than we already do.

@DemiMarie
Copy link

I'm honestly not a big fan of that either, since it has led to breakages on certain platforms (e.g. Wine) and could very easily break with no warning on future versions of Windows.

libuv already relies on the same behavior, so such breakage would be noticed pretty quickly.

However at this point the only alternatives are explicitly deprecated (WSAAsyncSelect) or incompatible with the current API (I/O Completion Ports), so I'm unsure as to what it would be replaced with.

NtAssociateWaitCompletionPacket can only be used with I/O completion ports. Its purpose is to support objects that IOCP does not.

One alternative would be to use the Windows thread pool API, but I doubt that would be compatible.

@notgull
Copy link
Member

notgull commented Aug 22, 2023

As of smol-rs/polling#98, waitable handles can be waited on in polling. It shouldn't be too hard to expose this in async-io.

@notgull notgull added the help wanted Extra attention is needed label Aug 22, 2023
notgull added a commit that referenced this issue Sep 23, 2023
This commit allows waitable handles to be polled in Windows. This allows
I/O constructs like processes, mutexes and waitable events be registered
into the poller and be polled just like anything else.

cc #25

Signed-off-by: John Nunley <[email protected]>
notgull added a commit that referenced this issue Dec 2, 2023
This commit allows waitable handles to be polled in Windows. This allows
I/O constructs like processes, mutexes and waitable events be registered
into the poller and be polled just like anything else.

cc #25

Signed-off-by: John Nunley <[email protected]>
notgull added a commit that referenced this issue Jan 13, 2024
This commit allows waitable handles to be polled in Windows. This allows
I/O constructs like processes, mutexes and waitable events be registered
into the poller and be polled just like anything else.

cc #25

Signed-off-by: John Nunley <[email protected]>
notgull added a commit that referenced this issue Jan 13, 2024
This commit allows waitable handles to be polled in Windows. This allows
I/O constructs like processes, mutexes and waitable events be registered
into the poller and be polled just like anything else.

cc #25

Signed-off-by: John Nunley <[email protected]>
@notgull notgull closed this as completed Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

No branches or pull requests

3 participants