This commit is contained in:
parent
b173cf594a
commit
8fd30ea15d
1 changed files with 8 additions and 7 deletions
|
@ -57,21 +57,22 @@ public class Lock extends SimpleLock {
|
||||||
*/
|
*/
|
||||||
public synchronized void waitHere() {
|
public synchronized void waitHere() {
|
||||||
if(!isTimed) {
|
if(!isTimed) {
|
||||||
while(relocking)
|
do
|
||||||
super.waitHere();
|
super.waitHere();
|
||||||
|
while(relocking);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!super.isLocked())
|
if(!super.isLocked())
|
||||||
return;
|
return;
|
||||||
while(relocking) {
|
do {
|
||||||
long wt = timeLeft0();
|
long wt = timeLeft0();
|
||||||
if(wt == 0) {
|
if(wt == 0) {
|
||||||
unlock();
|
unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.waitHere(wt);
|
super.waitHere(wt);
|
||||||
}
|
} while(relocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,19 +84,19 @@ public class Lock extends SimpleLock {
|
||||||
return;
|
return;
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
if(!isTimed) {
|
if(!isTimed) {
|
||||||
while(relocking) {
|
do {
|
||||||
long sectionOffset = System.currentTimeMillis() - start;
|
long sectionOffset = System.currentTimeMillis() - start;
|
||||||
long wt = timeout - sectionOffset;
|
long wt = timeout - sectionOffset;
|
||||||
if(wt == 0)
|
if(wt == 0)
|
||||||
break;
|
break;
|
||||||
super.waitHere(wt);
|
super.waitHere(wt);
|
||||||
}
|
} while(relocking);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!super.isLocked())
|
if(!super.isLocked())
|
||||||
return;
|
return;
|
||||||
while(relocking) {
|
do {
|
||||||
long wt = timeLeft0();
|
long wt = timeLeft0();
|
||||||
if(wt == 0) {
|
if(wt == 0) {
|
||||||
unlock();
|
unlock();
|
||||||
|
@ -106,7 +107,7 @@ public class Lock extends SimpleLock {
|
||||||
if(wt == 0)
|
if(wt == 0)
|
||||||
break;
|
break;
|
||||||
super.waitHere(wt);
|
super.waitHere(wt);
|
||||||
}
|
} while(relocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue