All languages

C

You're viewing a free preview. Sign in free to read every script.

Why this exists Threads share memory, which is what makes them fast and what makes them dangerous. Two threads changing the same variable without coordination produce results that are wrong only sometimes, which is the…

Threads with pthreads: Data Races, Mutexes, Atomics and a Producer-Consumer Queue

Create threads, watch a data race lose updates, fix it with a mutex and with atomics, and build a blocking bounded queue with a condition variable. Includes how to find races with ThreadSanitizer.

Sign in free to read this script, along with the rest of the library.

Sign in free