Remove the mutexes and use chan instead in order to handle the wait lock

Much clearer lock system. No conditional mutex, just block/unblock.