mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This fixes a deadlock that could occur when a cursor info request is cancelled while another one is inside the cancellation callback. The schematic deadlock backtrace is ``` sourcekitd::cancelRequest SourceKit::RequestTracker::cancel -> holds RequestTracker.RequestsMtx anonymous func in SourceKit::SwiftASTManager::processASTAsync SourceKit::SwiftASTConsumer::requestCancellation anonymous func in ASTBuildOperation::addConsumer -> tries to get ASTBuildOperation.ConsumersAndResultMtx resolveCursor SourceKit::SwiftASTManager::processASTAsync SourceKit::SwiftASTConsumer::requestCancellation anonymous func in ASTBuildOperation::addConsumer [probably inlined] ASTBuildOperation::requestConsumerCancellation -> holds ASTBuildOperation.ConsumersAndResultMtx resolveCursor::CursorInfoConsumer::cancelled anonymous func in SourceKit::SwiftLangSupport::getCursorInfo anonymous func in handleRequestCursorInfo reportCursorInfo anonymous func in sourcekitd::handleRequest -> tries to get RequestTracker.RequestsMtx ``` rdar://110357502
50 KiB
50 KiB