Change-Id: I4870aefa0c965bd0cf4ada19c01fa9b01efca171
--- /dev/null
+importJava "org.simantics.scl.runtime.utils.AsyncUtils" where
+ runAsync :: (<Proc> a) -> <Proc> ()
\ No newline at end of file
--- /dev/null
+package org.simantics.scl.runtime.utils;
+
+import org.simantics.scl.runtime.SCLContext;
+import org.simantics.scl.runtime.function.Function;
+import org.simantics.scl.runtime.tuple.Tuple0;
+
+public class AsyncUtils {
+ public static void runAsync(Function f) {
+ SCLContext context = SCLContext.getCurrent();
+ new Thread() {
+ @Override
+ public void run() {
+ SCLContext.push(context);
+ try {
+ f.apply(Tuple0.INSTANCE);
+ } finally {
+ SCLContext.pop();
+ }
+ }
+ }.start();
+ }
+}