moves sleep call out of a critical section references #283

This commit is contained in:
Peter Thorson
2013-10-20 14:44:37 -05:00
parent f4d3640870
commit 84efd0425a

View File

@@ -97,6 +97,8 @@ public:
websocketpp::lib::error_code ec;
while(1) {
bool wait = false;
{
scoped_lock guard(m_lock);
// If the connection has been closed, stop generating telemetry
@@ -104,11 +106,15 @@ public:
// If the connection hasn't been opened yet wait a bit and retry
if (!m_open) {
sleep(1);
continue;
wait = true;
}
}
if (wait) {
sleep(1);
continue;
}
val.str("");
val << "count is " << count++;