Skip to content

Commit 272c394

Browse files
committed
Workaround corelibs-libdispatch crash SR-10319
https://bugs.swift.org/browse/SR-10319
1 parent b3b4bba commit 272c394

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Index/IndexDatastore.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,21 @@ bool IndexDatastoreImpl::init(IndexStoreRef idxStore,
810810
Delegate->processingAddedPending(evts.size());
811811
eventsDeque->addEvents(evts);
812812

813+
#if defined(__APPLE__)
813814
// Create the block with QoS explicitly to ensure that the QoS from the indexstore callback can't affect the onFilesChange priority. This call may do a lot of I/O and we don't want to wedge the system by running at elevated priority.
814815
dispatch_block_t onUnitChangeBlock = dispatch_block_create_with_qos_class(DISPATCH_BLOCK_INHERIT_QOS_CLASS, unitChangesQOS, 0, ^{
815816
// Pass registration events to be processed incrementally by the global serial queue.
816817
// This allows intermixing processing of registration events from multiple workspaces.
817818
processUnitEventsIncrementally(eventsDeque, WeakUnitRepo, Delegate, getGlobalQueueForUnitChanges());
818819
});
820+
#else
821+
// FIXME: https://bugs.swift.org/browse/SR-10319
822+
auto onUnitChangeBlock = ^{
823+
// Pass registration events to be processed incrementally by the global serial queue.
824+
// This allows intermixing processing of registration events from multiple workspaces.
825+
processUnitEventsIncrementally(eventsDeque, WeakUnitRepo, Delegate, getGlobalQueueForUnitChanges());
826+
};
827+
#endif
819828
dispatch_async(getGlobalQueueForUnitChanges(), onUnitChangeBlock);
820829
Block_release(onUnitChangeBlock);
821830
};

0 commit comments

Comments
 (0)