Tag: Mutex
6 posts
-
C++ scoped_lock — Scoped locking, std::lock, and deadlock
Lock several mutexes at once with C++17 std::scoped_lock to avoid deadlock, and when lock_guard or unique_lock fits better, with a bank-transfer example.
-
C++ Mutex & Lock — Mutual Exclusion and lock_guard
C++ mutex and locks: std::mutex, lock_guard, unique_lock, std::lock, scoped_lock, recursive_mutex, timed_mutex, and avoiding deadlocks.
-
Rust Concurrency: Threads, Channels, Arc and Mutex, and the Errors You Will Hit
How std::thread, mpsc channels, Arc<Mutex<T>>, atomics and scoped threads work in Rust, why Send and Sync exist, and how to fix E0373, Rc-not-Send and lock bugs
-
C++ Data Races: When to Use Atomics Instead of Mutexes
C++ data races explained: mutex vs std::atomic, memory orders, deadlock avoidance, and compare-exchange—with examples.
-
Fixing Data Races with std::mutex: lock_guard, unique_lock, scoped_lock and Deadlock Avoidance
Fix C++ data races with std::mutex: choosing lock_guard, unique_lock or scoped_lock, how deadlocks form and how to avoid them, and what locking costs.
-
C++ Multithreading Crashes: Data Races, mutex, and atomic
Fix intermittent multithreaded crashes: data races vs race conditions, std::mutex, atomics, false sharing basics, condition variables.