{"action":"created","issue":{"url":"https://api.github.com/repos/python-trio/trio/issues/233","repository_url":"https://api.github.com/repos/python-trio/trio","labels_url":"https://api.github.com/repos/python-trio/trio/issues/233/labels{/name}","comments_url":"https://api.github.com/repos/python-trio/trio/issues/233/comments","events_url":"https://api.github.com/repos/python-trio/trio/issues/233/events","html_url":"https://github.com/python-trio/trio/issues/233","id":237713955,"node_id":"MDU6SXNzdWUyMzc3MTM5NTU=","number":233,"title":"Provide an API that does WaitForSingleObject on Windows","user":{"login":"njsmith","id":609896,"node_id":"MDQ6VXNlcjYwOTg5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/609896?v=4","gravatar_id":"","url":"https://api.github.com/users/njsmith","html_url":"https://github.com/njsmith","followers_url":"https://api.github.com/users/njsmith/followers","following_url":"https://api.github.com/users/njsmith/following{/other_user}","gists_url":"https://api.github.com/users/njsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/njsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njsmith/subscriptions","organizations_url":"https://api.github.com/users/njsmith/orgs","repos_url":"https://api.github.com/users/njsmith/repos","events_url":"https://api.github.com/users/njsmith/events{/privacy}","received_events_url":"https://api.github.com/users/njsmith/received_events","type":"User","site_admin":false},"labels":[{"id":523925659,"node_id":"MDU6TGFiZWw1MjM5MjU2NTk=","url":"https://api.github.com/repos/python-trio/trio/labels/Windows","name":"Windows","color":"dddddd","default":false},{"id":523592775,"node_id":"MDU6TGFiZWw1MjM1OTI3NzU=","url":"https://api.github.com/repos/python-trio/trio/labels/missing%20piece","name":"missing piece","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-22T02:18:23Z","updated_at":"2018-09-18T20:38:34Z","closed_at":"2018-09-18T20:38:34Z","author_association":"MEMBER","body":"As noted in #52, there are some events on Windows that can only be detected by calling one of the `WaitFor` family of functions (`WaitForSingleObject`, `WaitForSingleObjectEx`, `WaitForMultipleObjects`, etc. etc.). Some examples include child process exit (required for #4), and detecting console input (required for #174).\r\n\r\nTo resolve this issue, we should provide a `trio.hazmat.WaitForSingleObject` function that takes a `HANDLE`, and waits for it, and is cancellable.\r\n\r\nThe most straightforward way to do this is to allocate a thread to sit in `WaitForSingleObjectEx`, which can do an \"alertable wait\", which means that it's possible to cause the function to wake up early by calling `QueueUserAPC`. So we would use `QueueUserAPC` from inside our abort callback to implement cancellation. There are some more notes in `_io_windows.py`."},"comment":{"url":"https://api.github.com/repos/python-trio/trio/issues/comments/422545261","html_url":"https://github.com/python-trio/trio/issues/233#issuecomment-422545261","issue_url":"https://api.github.com/repos/python-trio/trio/issues/233","id":422545261,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjU0NTI2MQ==","user":{"login":"njsmith","id":609896,"node_id":"MDQ6VXNlcjYwOTg5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/609896?v=4","gravatar_id":"","url":"https://api.github.com/users/njsmith","html_url":"https://github.com/njsmith","followers_url":"https://api.github.com/users/njsmith/followers","following_url":"https://api.github.com/users/njsmith/following{/other_user}","gists_url":"https://api.github.com/users/njsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/njsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njsmith/subscriptions","organizations_url":"https://api.github.com/users/njsmith/orgs","repos_url":"https://api.github.com/users/njsmith/repos","events_url":"https://api.github.com/users/njsmith/events{/privacy}","received_events_url":"https://api.github.com/users/njsmith/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T20:38:34Z","updated_at":"2018-09-18T20:38:34Z","author_association":"MEMBER","body":"This was fixed in #575 "}}
{"actor":{"display_login":"njsmith"}}