Dune currently wraps all builds with a global mutex:
let build_system_mutex = Fiber.Mutex.create ()
let build f =
Fiber.Mutex.with_lock build_system_mutex ~f:(fun () ->
Build_system.run f)
This forces all builds—watch mode, RPC-driven builds, CI tasks, and editor requests—to run one at a time, even when they touch unrelated targets.
The result is unnecessary blocking across common
Here’s my PR that adds concurrent builds to Dune. The PR description explains the design. Implementation comes with proper tests.
I forgot to do this at first but here’s the proposal in a Github issue, with quantified benefits. Think of the PR above as a reference implementation.