Some Coding Challenges: Implementing a Lock.
2 min readMar 27, 2024
The challenge is to implement a lock in Java by only using synchronized, wait, notify
as constructs.
The lock shall work as follows:
var lock = new Lock();
private void doSomething(){
lock.lock();
// no other thread shall be able to go here in the meantime
lock.unlock();
}