Skip to content

Commit 023fdcf

Browse files
committed
fix lock
1 parent 483e25d commit 023fdcf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/kotlin/com/wsl/symlinks/vfs/WslVirtualFileSystem.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.wsl.symlinks.vfs
22

33
import ai.grazie.utils.WeakHashMap
44
import com.intellij.ide.AppLifecycleListener
5+
import com.intellij.idea.IdeaLogger
56
import com.intellij.openapi.components.service
67
import com.intellij.openapi.diagnostic.Attachment
78
import com.intellij.openapi.diagnostic.DefaultLogger
@@ -46,7 +47,8 @@ class MyLogger(category: String): DefaultLogger(category) {
4647

4748
companion object {
4849
fun setup() {
49-
Logger.setFactory { category -> MyLogger(category) }
50+
//IdeaLogger.setFactory { category -> MyLogger(category) }
51+
//Logger.setFactory { category -> MyLogger(category) }
5052
}
5153
// val logger = setup()
5254
}
@@ -64,7 +66,10 @@ class WslSymlinksProvider(distro: String) {
6466
fun getValue(): String? {
6567
var elapsed = 0
6668
while (value == null && elapsed < 500) {
67-
condition.await(10, TimeUnit.MILLISECONDS)
69+
if (myResourceLock.tryLock(10, TimeUnit.MILLISECONDS)) {
70+
condition.await(10, TimeUnit.MILLISECONDS)
71+
myResourceLock.unlock()
72+
}
6873
elapsed += 10
6974
}
7075
if (this.value == null) {

0 commit comments

Comments
 (0)