]> git.tdb.fi Git - builder.git/commitdiff
Don't busyloop while waiting for an internal task to complete
authorMikko Rasa <tdb@tdb.fi>
Mon, 9 Jan 2023 09:18:07 +0000 (11:18 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 9 Jan 2023 09:53:57 +0000 (11:53 +0200)
source/lib/internaltask.cpp

index fe3ae9d0666a5458fd9beb925c4491cb0f05bbee..101534cf8448f4e5bd714764f0513bd905413754 100644 (file)
@@ -1,5 +1,8 @@
+#include <msp/time/utils.h>
 #include "internaltask.h"
 
+using namespace Msp;
+
 InternalTask::~InternalTask()
 {
        worker.join();
@@ -22,7 +25,8 @@ Task::Status InternalTask::check()
 Task::Status InternalTask::wait()
 {
        Status result;
-       while((result = check())==RUNNING) ;
+       while((result = check())==RUNNING)
+               Time::sleep(10*Time::msec);
        return result;
 }