qinguoyi / TinyWebServer

:fire: Linux下C++轻量级WebServer服务器

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

条件变量中对wait代码的一个疑问

9Htang opened this issue · comments

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;