Skip to content

Commit 1de2793

Browse files
committed
fix lock
1 parent 96fe5eb commit 1de2793

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class WslSymlinksProvider(distro: String) {
7474
internal val condition = myResourceLock.newCondition()
7575
fun getValue(): String? {
7676
var elapsed = 0
77-
while (value == null && elapsed < 500) {
77+
while (value == null && elapsed < 5000) {
7878
if (myResourceLock.tryLock(10, TimeUnit.MILLISECONDS)) {
7979
condition.await(10, TimeUnit.MILLISECONDS)
8080
myResourceLock.unlock()
@@ -132,6 +132,7 @@ class WslSymlinksProvider(distro: String) {
132132
while (true) {
133133
try {
134134
val a = this.queue.take()
135+
if (a.value != null) continue
135136
mapped[a.id] = a
136137
this.processWriter.write(a.request!!)
137138
this.processWriter.flush()
@@ -177,6 +178,7 @@ class WslSymlinksProvider(distro: String) {
177178
val path: String = file.path.replace("^//wsl\\$/[^/]+".toRegex(), "").replace("""^//wsl.localhost/[^/]+""".toRegex(), "")
178179
val a = AsyncValue()
179180
a.request = "${a.id};is-symlink;${path}\n"
181+
this.queue.add(a)
180182
while (a.getValue() == null) {
181183
if (!queue.contains(a)) {
182184
this.queue.add(a)

0 commit comments

Comments
 (0)