-
-
Notifications
You must be signed in to change notification settings - Fork 379
Process: add a lock so that multiple tasks can wait() simultaneously #854
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #854 +/- ##
==========================================
+ Coverage 99.21% 99.21% +<.01%
==========================================
Files 101 101
Lines 12225 12240 +15
Branches 895 896 +1
==========================================
+ Hits 12129 12144 +15
Misses 75 75
Partials 21 21
Continue to review full report at Codecov.
|
|
Looks good, but seems to have caused a coverage drop in some of the low-level code. Maybe we're not testing |
…lect our inability to produce the error
| async with _core.open_nursery() as nursery: | ||
| with move_on_after(0.1): | ||
| await proc.wait() | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout here is a bit sloppy... it slows down the tests slightly, and if the OS scheduler decides it hates us then there's no guarantee that proc.wait will have reached the actual blocking point before the timeout fires. How about we do two rounds:
# Check that wait (including multi-wait) tolerates being cancelled
async with _core.open_nursery() as nursery:
nursery.start_soon(proc.wait)
nursery.start_soon(proc.wait)
nursery.start_soon(proc.wait)
await wait_all_tasks_blocked()
nursery.cancel_scope.cancel()
# Now try waiting for real
async with _core.open_nursery() as nursery:
nursery.start_soon(proc.wait)
nursery.start_soon(proc.wait)
nursery.start_soon(proc.wait)
await wait_all_tasks_blocked()
proc.kill()|
LGTM. There was a conflict with #862, whcih I think I resolved. If someone notices the CI passed while I wasn't looking, feel free to merge :-) |
Previously this would fail on kqueue platforms.