Figure 3: Using a single buffer protected by a mutually exclusive synchronization primitive.