From aa59c1de10b53df8a33d1df99b74b8a20052b9af Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 12 Jul 2013 22:07:48 -0400 Subject: Bunch of little bug fixes in newly refactored code. --- node/Node.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'node/Node.cpp') diff --git a/node/Node.cpp b/node/Node.cpp index 4b5a43ed..976de742 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -399,7 +399,7 @@ Node::ReasonForTermination Node::run() try { unsigned long delay = std::min((unsigned long)ZT_MIN_SERVICE_LOOP_INTERVAL,_r->sw->doTimerTasks()); uint64_t start = Utils::now(); - Thread::sleep(delay); + _r->mainLoopWaitCondition.wait(delay); lastDelayDelta = (long)(Utils::now() - start) - (long)delay; } catch (std::exception &exc) { LOG("unexpected exception running Switch doTimerTasks: %s",exc.what()); @@ -426,12 +426,14 @@ void Node::terminate() throw() { ((_NodeImpl *)_impl)->terminateNow = true; + ((_NodeImpl *)_impl)->renv.mainLoopWaitCondition.signal(); } void Node::updateStatusNow() throw() { ((_NodeImpl *)_impl)->updateStatusNow = true; + ((_NodeImpl *)_impl)->renv.mainLoopWaitCondition.signal(); } class _VersionStringMaker -- cgit v1.2.3