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

stdlib::child::Windows::ChildImp::try_wait shouldn't fail on timeout of GetQueuedCompletionStatus #2

Closed
bmc-msft opened this issue Aug 24, 2021 · 0 comments

Comments

@bmc-msft
Copy link
Contributor

Per the documentation on GetQueuedCompletionStatus:

The number of milliseconds that the caller is willing to wait for a completion packet to appear at the completion port. If a completion packet does not appear within the specified time, the function times out, returns FALSE, and sets *lpOverlapped to NULL.

As such, calling wait_imp(0) as shown here:

self.wait_imp(0)?;

Which calls GetQueuedCompletionStatus here:

res_bool(unsafe {
GetQueuedCompletionStatus(
self.handles.completion_port,
&mut code,
&mut key,
overlapped.as_mut_ptr(),
timeout,
)
})?;

A timeout will result in FALSE, which results in an Err.

This is contrary to normal behavior for try_wait. I would expect the try_wait to not fail on GetQueuedCompletionStatus timeout, but instead act like underlying impl of try_wait and return an Ok(None), or handle non-timeout errors specifically.

@bmc-msft bmc-msft changed the title stdlib::child::Windows::ChildImp::try_wait shouldn't fail on timeout of GetQueuedCompletionStatus stdlib::child::Windows::ChildImp::try_wait shouldn't fail on timeout of GetQueuedCompletionStatus Aug 24, 2021
@passcod passcod closed this as completed Aug 26, 2021
passcod added a commit that referenced this issue Aug 26, 2021
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

2 participants