Random variable tweaks & opts

This commit is contained in:
cyberpwn
2022-01-13 07:14:16 -05:00
parent 62c2757afc
commit 32a0fc9b17
13 changed files with 34 additions and 45 deletions

View File

@@ -43,15 +43,29 @@ public class SemaphoreStream<T> extends BasicStream<T> {
@Override
public T get(double x, double z) {
synchronized(getTypedSource()) {
return getTypedSource().get(x, z);
try {
semaphore.acquire();
T t = getTypedSource().get(x, z);
semaphore.release();
return t;
} catch(InterruptedException e) {
e.printStackTrace();
}
return null;
}
@Override
public T get(double x, double y, double z) {
synchronized(getTypedSource()) {
return getTypedSource().get(x, y, z);
try {
semaphore.acquire();
T t = getTypedSource().get(x, y, z);
semaphore.release();
return t;
} catch(InterruptedException e) {
e.printStackTrace();
}
return null;
}
}