improve code quality a bit
Some checks failed
/ Build & Publish (push) Failing after 41s

This commit is contained in:
Daniella 2024-06-25 05:51:31 +02:00
parent 909d95be09
commit 85f90ce11b
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -60,16 +60,17 @@ public class Lock extends SimpleLock {
return; return;
do { do {
if(!isTimed) { if(isTimed) {
super.waitHere();
continue;
}
long wt = timeLeft0(); long wt = timeLeft0();
if(wt == 0) { if(wt == 0) {
unlock(); unlock();
return; return;
} }
super.waitHere(wt); super.waitHere(wt);
}
else {
super.waitHere();
}
} while(relocking); } while(relocking);
} }
@ -87,14 +88,7 @@ public class Lock extends SimpleLock {
do { do {
long sectionOffset = System.currentTimeMillis() - start; long sectionOffset = System.currentTimeMillis() - start;
if(!isTimed) { if(isTimed) {
long wt = timeout - sectionOffset;
if(wt <= 0)
return;
super.waitHere(wt);
continue;
}
long wt = timeLeft0(); long wt = timeLeft0();
if(wt == 0) { if(wt == 0) {
unlock(); unlock();
@ -104,6 +98,13 @@ public class Lock extends SimpleLock {
if(wt <= 0) if(wt <= 0)
return; return;
super.waitHere(wt); super.waitHere(wt);
}
else {
long wt = timeout - sectionOffset;
if(wt <= 0)
return;
super.waitHere(wt);
}
} while(relocking); } while(relocking);
} }