diff options
Diffstat (limited to 'JavaScript Beginner Tutorial/03 Threading/01 Thread B.js')
-rw-r--r-- | JavaScript Beginner Tutorial/03 Threading/01 Thread B.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/JavaScript Beginner Tutorial/03 Threading/01 Thread B.js b/JavaScript Beginner Tutorial/03 Threading/01 Thread B.js new file mode 100644 index 0000000..9470611 --- /dev/null +++ b/JavaScript Beginner Tutorial/03 Threading/01 Thread B.js @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2014 Christian Pontesegger and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Pontesegger - initial API and implementation + *******************************************************************************/ + +function sleep(time) { + start = java.lang.System.currentTimeMillis(); + while (start + time > java.lang.System.currentTimeMillis()) + ; +} + +for each (arg in argv) + print("Argument: " + arg); + +loadModule('/System/Scripting'); + +file = getSharedObject("file"); +print("Thread B: " + file); + +for (var i = 1; i< 10; i++) { + print("Thread B, " + i); + sleep(10); +}
\ No newline at end of file |