I am trying to get my locking to work, using synchronized, wait and notifyAll. I had been calling wait inside lock() but it hung my application. (Waiting forever). I have never written multi-threaded code before, and this is pretty confusing. From searching and reading lots of old posts, I am pretty sure I synchronize on my Map of locks, and only call notifyAll from unlock(). I am wondering if I even need to wait?
I have the "consume no CPU cycles" in my instructions, so I'm pretty sure setting a timeout is a bad idea, and probably automatic failure. I also understand the notifyAll might consume a few (trivial few), but people generally have passed with full marks and used it. Thanks in advance.