Browse Source

Run IPC threads at 10hz as to not eat CPU

JoshEngebretson 10 years ago
parent
commit
ab554d3fd6

+ 4 - 0
Source/Atomic/IPC/IPCBroker.cpp

@@ -25,6 +25,7 @@
 #endif
 #endif
 
 
 #include "../Core/StringUtils.h"
 #include "../Core/StringUtils.h"
+#include "../Core/Timer.h"
 #include "../IO/Log.h"
 #include "../IO/Log.h"
 
 
 #include "IPCUnix.h"
 #include "IPCUnix.h"
@@ -59,6 +60,9 @@ void IPCBroker::ThreadFunction()
         {
         {
             break;
             break;
         }
         }
+
+        // sleep thread a bit so we don't gobble CPU
+        Time::Sleep(100);
     }
     }
 
 
     shouldRun_ = false;
     shouldRun_ = false;

+ 3 - 0
Source/Atomic/IPC/IPCWindows.cpp

@@ -28,6 +28,7 @@
 #include <Aclapi.h>
 #include <Aclapi.h>
 #include <string>
 #include <string>
 
 
+#include "../Core/Timer.h"
 #include "IPCWindows.h"
 #include "IPCWindows.h"
 
 
 typedef std::wstring IPCWString;
 typedef std::wstring IPCWString;
@@ -214,6 +215,8 @@ void PipeWin::ReaderThread::ThreadFunction()
             readSize_ = (unsigned) bytesRead;
             readSize_ = (unsigned) bytesRead;
         }
         }
 
 
+        Time::Sleep(100);
+
     }
     }
 }
 }
 
 

+ 3 - 0
Source/Atomic/IPC/IPCWorker.cpp

@@ -20,6 +20,7 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
+#include "../Core/Timer.h"
 #include "../IO/Log.h"
 #include "../IO/Log.h"
 
 
 #include "IPCWorker.h"
 #include "IPCWorker.h"
@@ -109,6 +110,8 @@ void IPCWorker::ThreadFunction()
         {
         {
            break;
            break;
         }
         }
+
+        Time::Sleep(100);
     }
     }
 
 
     shouldRun_ = false;
     shouldRun_ = false;