Implement the lock abstraction