条件变量中对wait代码的一个疑问
9Htang opened this issue · comments
9Htang commented
bool wait(pthread_mutex_t *m_mutex)
{
int ret = 0;
//pthread_mutex_lock(&m_mutex);
ret = pthread_cond_wait(&m_cond, m_mutex);
//pthread_mutex_unlock(&m_mutex);
return ret == 0;
}
请问这边为什么不直接 return pthread_cond_wait(&m_cond, m_mutex) == 0;