--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.simulator.variable;\r
+\r
+/**\r
+ * Realm controls access to some local resource.\r
+ * \r
+ * @author Hannu Niemistö\r
+ * @author Antti Villberg\r
+ */\r
+public interface Realm {\r
+\r
+ /**\r
+ * Executes the given runnable in this realm synchronously so that the method\r
+ * returns only after the runnable has finished. Can be called only when not \r
+ * inside the realm. Calling the method in the realm either causes \r
+ * a deadlock or {@link IllegalStateException}. \r
+ * @throws InterruptedException \r
+ */\r
+ void syncExec(Runnable runnable) throws InterruptedException;\r
+ \r
+ /**\r
+ * Executes the runnable in this realm asynchronously.\r
+ * This method can be called freely inside or outside of the realm. \r
+ * When executed inside the realm it is guaranteed that no \r
+ * internal event (for example a simulator step) is taken before\r
+ * executing the runnable.\r
+ */\r
+ void asyncExec(Runnable runnable);\r
+ \r
+}\r