mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
added a method for pausing the simulation that doesn't block
This commit is contained in:
parent
a15f424753
commit
3aeaf86b1a
@ -24,7 +24,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Simulation.java,v 1.59 2010/02/03 12:15:37 fros4943 Exp $
|
||||
* $Id: Simulation.java,v 1.60 2010/02/03 15:33:36 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja;
|
||||
@ -314,8 +314,27 @@ public class Simulation extends Observable implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops simulation and conditionally blocks until stopped.
|
||||
*
|
||||
* @param block Blocks if true
|
||||
*
|
||||
* @see #stopSimulation()
|
||||
*/
|
||||
public void stopSimulation(boolean block) {
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (block) {
|
||||
stopSimulation();
|
||||
} else {
|
||||
stopSimulation = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops this simulation (notifies observers).
|
||||
* Method blocks until simulation has stopped.
|
||||
*/
|
||||
public void stopSimulation() {
|
||||
if (isRunning()) {
|
||||
|
Loading…
Reference in New Issue
Block a user