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) {
long wt = timeLeft0();
if(wt == 0) {
unlock();
return;
}
super.waitHere(wt);
}
else {
super.waitHere(); super.waitHere();
continue;
} }
long wt = timeLeft0();
if(wt == 0) {
unlock();
return;
}
super.waitHere(wt);
} while(relocking); } while(relocking);
} }
@ -87,23 +88,23 @@ public class Lock extends SimpleLock {
do { do {
long sectionOffset = System.currentTimeMillis() - start; long sectionOffset = System.currentTimeMillis() - start;
if(!isTimed) { if(isTimed) {
long wt = timeLeft0();
if(wt == 0) {
unlock();
return;
}
wt = Math.min(wt, timeout - sectionOffset);
if(wt <= 0)
return;
super.waitHere(wt);
}
else {
long wt = timeout - sectionOffset; long wt = timeout - sectionOffset;
if(wt <= 0) if(wt <= 0)
return; return;
super.waitHere(wt); super.waitHere(wt);
continue;
} }
long wt = timeLeft0();
if(wt == 0) {
unlock();
return;
}
wt = Math.min(wt, timeout - sectionOffset);
if(wt <= 0)
return;
super.waitHere(wt);
} while(relocking); } while(relocking);
} }