Repository navigation
Commit 920ff28
committed
Address review and bugs in release watcher
Start dpctl's thread with the first release deferred instead of at
import. Start it again in the child of a fork, through
os.register_at_fork, and replace it if it ended on its own while the
interpreter is still live.
stop() waits at most a second for a release that blocks and then
detaches the thread. It no longer holds the watcher's lock while
waiting, so a concurrent start cannot deadlock. The thread stays
stopped until started again, and releases it has not run yet go back
on the list.
collect_due queries events without holding the list's lock, so a long
list does not hold up defer. The poll interval is capped at 100 ms.
The interpreter's forced unwind of the thread now propagates through
the watcher, run_collected and drain, and still reports the thread
finished. The GIL is released if run_collected throws. A failure to
start the thread after an item is pushed no longer makes
async_dec_ref report a scheduled release as failed.
keep_args_alive copies depends into a tuple, so the event count
matches what it iterates over, and calls async_dec_ref without the
GIL. dpctl4pybind11.hpp loads dpctl_capi outside the static
initializer of get_deferred_releases().
Add tests for an exit and a stop with a release that blocks, a start
during a stop, releases in a forked child, and a depends whose length
differs from its iteration.1 parent 111664e commit 920ff28
7 files changed
Lines changed: 574 additions & 100 deletions
File tree
- dpctl
- apis/include
- detail
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments