瀏覽代碼

Fix event stream related API deprecation (#16152)

Signed-off-by: moudgils <[email protected]>
moudgils 2 年之前
父節點
當前提交
01c8e26854

+ 1 - 0
Code/Tools/AssetProcessor/Platform/Mac/native/FileWatcher/FileWatcher_mac.h

@@ -33,5 +33,6 @@ public:
     void ConsumeEvents(size_t numEvents, const char **filePaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]);
     
     FileWatcher* m_watcher = nullptr;
+    dispatch_queue_t m_dispatchQueue;
 };
 

+ 3 - 1
Code/Tools/AssetProcessor/Platform/Mac/native/FileWatcher/FileWatcher_macos.cpp

@@ -60,6 +60,8 @@ bool FileWatcher::PlatformStart()
 
     AZ_Error("FileWatcher", (m_platformImpl->m_stream != nullptr), "FSEventStreamCreate returned a nullptr. No file events will be reported.");
 
+    m_platformImpl->m_dispatchQueue = dispatch_queue_create("EventStreamQueue", DISPATCH_QUEUE_CONCURRENT);
+    
     const CFIndex pathCount = CFArrayGetCount(pathsToWatch);
     for(CFIndex i = 0; i < pathCount; ++i)
     {
@@ -93,7 +95,7 @@ void FileWatcher::WatchFolderLoop()
     static const CFTimeInterval secondsToProcess = 0.5;
 
     m_platformImpl->m_runLoop = CFRunLoopGetCurrent();
-    FSEventStreamScheduleWithRunLoop(m_platformImpl->m_stream, m_platformImpl->m_runLoop, kCFRunLoopDefaultMode);
+    FSEventStreamSetDispatchQueue(m_platformImpl->m_stream, m_platformImpl->m_dispatchQueue);
     FSEventStreamStart(m_platformImpl->m_stream);
 
     const bool returnAfterFirstEventHandled = false;