# Fix process teardown deadlock on Windows \(\#55065\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 067ec60e1a197fb02df7cf7be7ea1170d8faee1d

Requested commit: 067ec60e1a197fb02df7cf7be7ea1170d8faee1d

Commit: 067ec60e1a197fb02df7cf7be7ea1170d8faee1d

Tree: 77e9d6984d0bc116174c5ab1fe55692840a0ef44

Author: John Tur

Committer: GitHub

## Message

```
Fix process teardown deadlock on Windows (#55065)

AWS-LC registers an `atexit` handler that intentionally acquires a lock
without releasing it. AWS-LC also has `thread_local` objects which
acquire this lock in their destructor. Destructors for `thread_local`s
run under the loader lock. So, there is a race condition where, if a
thread exits after `atexit` handlers have run, the TLS destructors will
block indefinitely on this lock while holding the loader lock. Since
`ExitProcess` also requires the loader lock, process teardown will
deadlock.


Closes #54856

Release Notes:

- Fixed an issue where the Zed process wouldn't exit after closing all
windows
```

## Parents

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

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