Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR avoids a potential deadlock on shutdown of a Lean program when the number of pooled threads has temporarily been pushed above the limit. There's a potential race between the finalizer "waking up everyone" after setting `m_shutting_down = true` and a worker that is about to be throttled because of concurrency limits. - `m_max_std_workers = 1`, `m_std_workers.size() = 2`, and the queue still has tasks. - Finalizer sets `m_shutting_down = true` and calls `notify_all()` while a worker is running a task (outside of the mutex). - Worker finishes a task, re-enters the loop, sees work, and "should wait" because `active >= max`. - Worker then calls `wait()` after the notify and never wakes, so `join()` in the finalizer hangs. This PR avoids the worker being blocked by not `wait()`ing if we are already shutting down. The code is restructured a bit for readability, where the first section is "there's no work in the queue" and the next section is "there is some work in the queue" |
||
|---|---|---|
| .claude | ||
| .github | ||
| doc | ||
| images | ||
| releases_drafts | ||
| script | ||
| src | ||
| stage0 | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .gitpod.Dockerfile | ||
| .gitpod.yml | ||
| .ignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| lean-toolchain | ||
| lean.code-workspace | ||
| LICENSE | ||
| LICENSES | ||
| README.md | ||
| RELEASES.md | ||
This is the repository for Lean 4.
About
- Quickstart
- Homepage
- Theorem Proving Tutorial
- Functional Programming in Lean
- Documentation Overview
- Language Reference
- Release notes starting at v4.0.0-m3
- Examples
- External Contribution Guidelines
Installation
See Install Lean.
Contributing
Please read our Contribution Guidelines first.
Building from Source
See Building Lean.