Note: When using semaphores in a Producer-consumer model, the semaphores act as a fill count. Differences from previous example /* This approach replaces the CircularBuffer 'end' field with the 'count' field and