This change fixes a lost wakeup bug in the "Make simultaneous IPC calls on single remote thread" test which is probably responsible for the hang reported https://github.com/bitcoin/bitcoin/issues/35491. The bug has existed since the test was introduced in 1238170f68e8fa7ae41c79465df5cdae34d568e9.
The change adds an MP_GUARDED_BY(m_mutex) annotation to Waiter::m_cv, and locks the mutex before notifying the condition variable in the test to satisfy the guarded-by requirement.
Locking the mutex prevents a hang in the test that could happen because if there is no lock between the running -= 1 state update and notifying the condition variable, there is no guarantee that the test is actively waiting on the condition variable when the notify call is made, so the notify might do nothing, and the test could wait forever.
(edited by ryanofsky)