mirror of
https://github.com/corda/corda.git
synced 2025-01-28 15:14:48 +00:00
9bb3d6b972
git-subtree-dir: sgx-jvm/avian git-subtree-mainline: f978eab8d134c88f88ff67e49458a771c32351db git-subtree-split: 09e4fe60d01f4f4bfb6b2976973bb4913ef61edc
25 lines
499 B
Java
25 lines
499 B
Java
public class Busy {
|
|
private static volatile int foo = 0;
|
|
private static volatile boolean go;
|
|
|
|
public static void main(String[] args) {
|
|
final Object lock = new Object();
|
|
|
|
synchronized (lock) {
|
|
new Thread() {
|
|
public void run() {
|
|
while (foo < 100) {
|
|
go = true;
|
|
}
|
|
}
|
|
}.start();
|
|
|
|
while (foo < 100) {
|
|
while (! go) { }
|
|
go = false;
|
|
byte[] array = new byte[256 * 1024];
|
|
++ foo;
|
|
}
|
|
}
|
|
}
|
|
} |