Quick Contact

✉
fahimkhan20148@gmail.com
📱
+971 507 286 133
Back to Notes
August 18, 2026
concurrencythreads

Scoped Threads

Scoped threads are used to spawn threads that finish execution before the scope is exited. This lets threads borrow local variables because the data outlives their scope.

All threads spawned in the scope will be joined before the scope exits. Multiple read references can be shared across threads, but only one mutable reference is allowed at a time.