线程睡眠

condition_variable m_wait;
mutex m_mutex;
std::atomic_bool m_stop;
while(true)
{
	unique_lock<mutex> lock(m_mutex);
	m_wait.wait(lock, [&]{
		return m_stop.load(std:memory_order_relaxed) || m_send_buf.empty() ==false;
	});
	if(m_stop.load(std::memory_order_relaxed))
		break;
	sendDatas = std::move(m_send_buf);
}
Table of Contents