*bugfix: should manually unlock before joining the thread waiting for condition variable
forgotten ;