Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 22s8 days 9 hours 54 minutes 22 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 22s8 days 9 hours 54 minutes 22 seconds.

Sign in to watch this lesson
Races and Locks · 3:57
How a std::mutex makes a critical section exclusive, why you lock it with std::lock_guard or std::scoped_lock rather than calling unlock() by hand, and how one stray reference to the protected data defeats every lock in the class (Listing 3.2, caught by ThreadSanitizer). We also measure what a lock costs on an Apple M3: well under twenty nanoseconds uncontended, while eight threads sharing one mutex finish the same work about twice as slowly as one thread alone.