The mutex need be locked before using the cond