introduced global timeout function, not yet documented

This commit is contained in:
fros4943 2010-08-17 15:04:15 +00:00
parent 49353be13b
commit 5a46c64e57

View file

@ -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: ScriptParser.java,v 1.7 2009/06/15 16:53:32 fros4943 Exp $ * $Id: ScriptParser.java,v 1.8 2010/08/17 15:04:15 fros4943 Exp $
*/ */
package se.sics.cooja.plugins; package se.sics.cooja.plugins;
@ -223,6 +223,7 @@ public class ScriptParser {
public static String getJSCode(String code, String timeoutCode) { public static String getJSCode(String code, String timeoutCode) {
return return
"timeout_function = null; " +
"function run() { " + "function run() { " +
"SEMAPHORE_SIM.acquire(); " + "SEMAPHORE_SIM.acquire(); " +
"SEMAPHORE_SCRIPT.acquire(); " + /* STARTUP BLOCKS HERE! */ "SEMAPHORE_SCRIPT.acquire(); " + /* STARTUP BLOCKS HERE! */
@ -247,6 +248,7 @@ public class ScriptParser {
"\n" + "\n" +
"function SCRIPT_TIMEOUT() { " + "function SCRIPT_TIMEOUT() { " +
timeoutCode + "; " + timeoutCode + "; " +
" if (timeout_function != null) { timeout_function(); } " +
" log.log('TEST TIMEOUT\\n'); " + " log.log('TEST TIMEOUT\\n'); " +
" log.testFailed(); " + " log.testFailed(); " +
" while (!SHUTDOWN) { " + " while (!SHUTDOWN) { " +