fix lock not waiting
All checks were successful
/ Build & Publish (push) Successful in 49s

This commit is contained in:
Daniella / Tove 2024-06-25 05:22:22 +02:00
parent b173cf594a
commit 8fd30ea15d
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -57,21 +57,22 @@ public class Lock extends SimpleLock {
*/
public synchronized void waitHere() {
if(!isTimed) {
while(relocking)
do
super.waitHere();
while(relocking);
return;
}
if(!super.isLocked())
return;
while(relocking) {
do {
long wt = timeLeft0();
if(wt == 0) {
unlock();
return;
}
super.waitHere(wt);
}
} while(relocking);
}
/**
@ -83,19 +84,19 @@ public class Lock extends SimpleLock {
return;
long start = System.currentTimeMillis();
if(!isTimed) {
while(relocking) {
do {
long sectionOffset = System.currentTimeMillis() - start;
long wt = timeout - sectionOffset;
if(wt == 0)
break;
super.waitHere(wt);
}
} while(relocking);
return;
}
if(!super.isLocked())
return;
while(relocking) {
do {
long wt = timeLeft0();
if(wt == 0) {
unlock();
@ -106,7 +107,7 @@ public class Lock extends SimpleLock {
if(wt == 0)
break;
super.waitHere(wt);
}
} while(relocking);
}
/**