fix: reduce cpu utilization at launch

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-07-11 03:31:50 +09:00
1 parent 5b2edfb84b
commit 5306a4b95c
1 file changed
+2
+2
View File
@@ -48,6 +48,8 @@ class BackgroundThreadWithRunLoop {
self.runLoop = CFRunLoopGetCurrent()
while !self.thread!.isCancelled {
CFRunLoopRun()
// avoid tight loop while waiting for the first runloop source to be added
Thread.sleep(forTimeInterval: 0.1)
}
}
thread!.name = name