瀏覽代碼

Added 100 ms sleep to the OS X FileWatcher thread loop to avoid framerate stutter.

Lasse Öörni 13 年之前
父節點
當前提交
feff1fdbe7
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      Engine/IO/FileWatcher.cpp

+ 5 - 3
Engine/IO/FileWatcher.cpp

@@ -24,7 +24,8 @@
 #include "File.h"
 #include "File.h"
 #include "FileSystem.h"
 #include "FileSystem.h"
 #include "FileWatcher.h"
 #include "FileWatcher.h"
-#include "Log.h"
+#include "Log.h"
+#include "Timer.h"
 
 
 #ifdef WIN32
 #ifdef WIN32
 #include <windows.h>
 #include <windows.h>
@@ -178,7 +179,6 @@ bool FileWatcher::StartWatching(const String& pathName, bool watchSubDirs)
         return false;
         return false;
     }
     }
 #else
 #else
-    /// \todo Implement on Unix-like systems
     LOGERROR("FileWatcher not implemented, can not start watching path " + pathName);
     LOGERROR("FileWatcher not implemented, can not start watching path " + pathName);
     return false;
     return false;
 #endif
 #endif
@@ -292,7 +292,9 @@ void FileWatcher::ThreadFunction()
     }
     }
 #elif defined(__APPLE__) && !defined(IOS)
 #elif defined(__APPLE__) && !defined(IOS)
     while (shouldRun_)
     while (shouldRun_)
-    {
+    {
+        Time::Sleep(100);
+
         String changes = ReadFileWatcher(watcher_);
         String changes = ReadFileWatcher(watcher_);
         if (!changes.Empty())
         if (!changes.Empty())
         {
         {