We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
是什么原因使这里要进行两次检验啊(如果上一步timewait为true,那m_size应该就不会是0了,因为所有相关操作都加了锁)? if (m_size <= 0) { t.tv_sec = now.tv_sec + ms_timeout / 1000; t.tv_nsec = (ms_timeout % 1000) * 1000; if (!m_cond.timewait(m_mutex.get(), t)) { m_mutex.unlock(); return false; } } if (m_size <= 0) { m_mutex.unlock(); return false; }
The text was updated successfully, but these errors were encountered:
我也感觉是多余的,有数据而且当前也加了锁,应该不可能再产生为0的情况了吧
Sorry, something went wrong.
我也认为有些多余
No branches or pull requests
是什么原因使这里要进行两次检验啊(如果上一步timewait为true,那m_size应该就不会是0了,因为所有相关操作都加了锁)?
if (m_size <= 0)
{
t.tv_sec = now.tv_sec + ms_timeout / 1000;
t.tv_nsec = (ms_timeout % 1000) * 1000;
if (!m_cond.timewait(m_mutex.get(), t))
{
m_mutex.unlock();
return false;
}
}
if (m_size <= 0)
{
m_mutex.unlock();
return false;
}
The text was updated successfully, but these errors were encountered: