setup wait/notify with loop and locks