Skip to main content

Module process_guard

Module process_guard 

Source
Expand description

Global concurrency limiter for lean-ctx processes.

Prevents runaway CPU usage by limiting the number of concurrent lean-ctx processes to MAX_CONCURRENT. Each process acquires a numbered lock slot under ~/.lean-ctx/locks/. If all slots are taken, the caller gets None.

Structs§

ProcessGuard

Functions§

acquire
Try to acquire one of N concurrent process slots. Returns None if all slots are occupied (= too many lean-ctx already running).
active_count
Checks how many slots are currently held (best-effort).