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