bugfix: hold m_lock while using m_wait