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