Process: add a lock so that multiple tasks can wait() simultaneously#854
Process: add a lock so that multiple tasks can wait() simultaneously#854sorcio merged 8 commits intopython-trio:masterfrom
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.
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.