[Verse 1] When threads all need the same data to read And writing together could cause what we dread Race conditions will crash what you're building today Rust has the tools to keep chaos at bay [Chorus] Arc and Mutex, lock it down Reference counting keeps data sound Clone the Arc but share the core Mutex guards what threads explore Arc and Mutex, Rust's best friends Safe concurrency that never ends [Verse 2] Atomically Reference Counted, that's what Arc means Wrapping your data in thread-safe scenes Clone the pointer, not the data inside Multiple owners can safely reside [Chorus] Arc and Mutex, lock it down Reference counting keeps data sound Clone the Arc but share the core Mutex guards what threads explore Arc and Mutex, Rust's best friends Safe concurrency that never ends [Verse 3] Mutual exclusion, Mutex is the key Only one thread can access, you see Lock and unlock, the guard will protect Drop the guard when you're done to disconnect [Bridge] Wrap your Mutex in an Arc to share Send it safely everywhere Lock will block until it's free That's concurrent harmony [Chorus] Arc and Mutex, lock it down Reference counting keeps data sound Clone the Arc but share the core Mutex guards what threads explore Arc and Mutex, Rust's best friends Safe concurrency that never ends [Outro] No more data races in your code Shared state travels down the road Arc and Mutex hand in hand Making concurrency safe and grand
← Rivers of Code | Don't Make Me Wait (While Others Stay Awake) →