浏览代码

CEventLoop: Don't call gettimeofday() at all if there are no timers.

Andreas Kling 6 年之前
父节点
当前提交
3b986da643
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      LibCore/CEventLoop.cpp

+ 2 - 1
LibCore/CEventLoop.cpp

@@ -171,7 +171,8 @@ void CEventLoop::wait_for_event()
     }
 
     timeval now;
-    gettimeofday(&now, nullptr);
+    if (!s_timers->is_empty())
+        gettimeofday(&now, nullptr);
 
     for (auto& it : *s_timers) {
         auto& timer = *it.value;