Rust Atomics and Locks
Last modified: Wed May 11 2022 11:00:32 GMT+0000 (Coordinated Universal Time)
std::thread::spawn
is just a shorthand for the ThreadBuilder (std::thread::Builder
) which allow us to set some
settings for the new thtead before spawming it. SUch as: stack size and thread name. A thread name shows in the panic messages and will
be visible in monitoring and debugging tools on most platforms.
- thread parking can be an easy way to wait for some condition
- When a condition is about dat aprotected by a Mutex, using a
Condvar
is more convenient, and can be more efficient, than thread parking.
No backlinks found.