Microsoft interview question

Implement a lock.