Skip to content

Workaround corelibs-libdispatch crash SR-10319 #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/Index/IndexDatastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,12 +810,19 @@ bool IndexDatastoreImpl::init(IndexStoreRef idxStore,
Delegate->processingAddedPending(evts.size());
eventsDeque->addEvents(evts);

// 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.
dispatch_block_t onUnitChangeBlock = dispatch_block_create_with_qos_class(DISPATCH_BLOCK_INHERIT_QOS_CLASS, unitChangesQOS, 0, ^{
auto onUnitChangeBlockImpl = ^{
// Pass registration events to be processed incrementally by the global serial queue.
// This allows intermixing processing of registration events from multiple workspaces.
processUnitEventsIncrementally(eventsDeque, WeakUnitRepo, Delegate, getGlobalQueueForUnitChanges());
});
};

#if defined(__APPLE__)
// 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.
dispatch_block_t onUnitChangeBlock = dispatch_block_create_with_qos_class(DISPATCH_BLOCK_INHERIT_QOS_CLASS, unitChangesQOS, 0, onUnitChangeBlockImpl);
#else
// FIXME: https://bugs.swift.org/browse/SR-10319
auto onUnitChangeBlock = Block_copy(onUnitChangeBlockImpl);
#endif
dispatch_async(getGlobalQueueForUnitChanges(), onUnitChangeBlock);
Block_release(onUnitChangeBlock);
};
Expand Down