Caterpillar interview question

Write a singleton class. it should be thread safe