mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-14 09:28:59 +00:00
using timeout event instead of slower tick observer
This commit is contained in:
parent
c6d6bb4a14
commit
0083cc2080
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ScriptRunnerNoGUI.java,v 1.4 2008/11/05 18:18:16 fros4943 Exp $
|
* $Id: ScriptRunnerNoGUI.java,v 1.5 2008/12/03 16:23:26 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.plugins;
|
package se.sics.cooja.plugins;
|
||||||
@ -154,19 +154,17 @@ public class ScriptRunnerNoGUI implements Plugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Create timeout watch */
|
/* Create timeout event */
|
||||||
sim.addTickObserver(new Observer() {
|
sim.scheduleEvent(new TimeEvent(0) {
|
||||||
public void update(Observable obs, Object obj) {
|
public void execute(int t) {
|
||||||
if (sim.getSimulationTime() > TIMEOUT) {
|
try {
|
||||||
try {
|
logWriter.write("TEST TIMEOUT");
|
||||||
logWriter.write("TEST TIMEOUT");
|
logWriter.flush();
|
||||||
logWriter.flush();
|
} catch (IOException e) {
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
gui.doQuit(false);
|
|
||||||
}
|
}
|
||||||
|
gui.doQuit(false);
|
||||||
}
|
}
|
||||||
});
|
}, TIMEOUT);
|
||||||
|
|
||||||
/* Start simulation and leave control to script */
|
/* Start simulation and leave control to script */
|
||||||
sim.startSimulation();
|
sim.startSimulation();
|
||||||
|
Loading…
Reference in New Issue
Block a user