setup wait/notify with loop and locks
Merge pull request #1310 from john-hill/fix-test

setup wait/notify with loop and locks