# Fix "Task polled after completion" panic \(\#60693\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/2c4e44704c37ee87e59ac84e3e17388178b28545)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 2c4e44704c37ee87e59ac84e3e17388178b28545

Requested commit: 2c4e44704c37ee87e59ac84e3e17388178b28545

Commit: 2c4e44704c37ee87e59ac84e3e17388178b28545

Tree: f0a632c75a2e8264bc01d7fc04ede009229dfa3f

Author: John Tur

Committer: GitHub

## Message

```
Fix "Task polled after completion" panic (#60693)

Dropping a scheduled runnable cancels its task and makes the next poll
of any awaiter panic with "Task polled after completion." The only paths
where we drop these runnables seem to be during shutdown or extreme
resource exhaustion, so, let's leak the runnables instead of crashing.

On Windows, we also moved to calling the Win32 thread pool API directly,
because 1) WinRT thread pool API is just a wrapper that adds overhead we
don't need, and 2) the closure we pass to the `WorkItemHandler` object
takes ownership of the runnable object, so if the WinRT thread pool
releases the delegate, it can free the runnable without our control.

Release Notes:

- N/A
```

## Parents

- [35ffa8f480838257ae9650027cb9847505a0882b](https://git.cafe/gitcafe/zed/commit/35ffa8f480838257ae9650027cb9847505a0882b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/2c4e44704c37ee87e59ac84e3e17388178b28545?format=markdown)
