Implement a thread-safe producer–consumer buffer | Anthropic