synchronized method

This commit is contained in:
Alex Tkachman
2011-12-19 10:21:17 +02:00
parent 9a7d947899
commit 1e471aa9c4
7 changed files with 78 additions and 1 deletions
+8
View File
@@ -1,5 +1,7 @@
package jet.runtime;
import jet.Function0;
import java.util.ArrayList;
/**
@@ -29,6 +31,12 @@ public class Intrinsics {
return (thisVal == anotherVal ? 0 : (anotherVal ? 1 : -1));
}
public static <R> R stupidSync(Object lock, Function0<R> block) {
synchronized (lock) {
return block.invoke();
}
}
private static Throwable sanitizeStackTrace(Throwable throwable) {
StackTraceElement[] stackTrace = throwable.getStackTrace();
ArrayList<StackTraceElement> list = new ArrayList<StackTraceElement>();