Google interview question

Implement a circular buffer ; make it thread-safe