Perform tryLock-and-checkCanceled on waiting lock in LockBasedStorageManager

Relates to #KT-38012
This commit is contained in:
Vladimir Dolzhenko
2020-04-09 16:23:24 +02:00
parent 6fae29bcc0
commit b0483a67c2
7 changed files with 117 additions and 27 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.context
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
@@ -85,7 +86,9 @@ class MutableModuleContextImpl(
fun GlobalContext(debugName: String): GlobalContextImpl {
val tracker = ExceptionTracker()
return GlobalContextImpl(LockBasedStorageManager.createWithExceptionHandling(debugName, tracker), tracker)
return GlobalContextImpl(LockBasedStorageManager.createWithExceptionHandling(debugName, tracker) {
ProgressManager.checkCanceled()
}, tracker)
}
fun ProjectContext(project: Project, debugName: String): ProjectContext = ProjectContextImpl(project, GlobalContext(debugName))