beard 3a654f69c4 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@4274 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-23 02:05:14 +00:00

32 lines
583 B
Java

package netscape.javascript;
/**
* Runs a JavaScript object with a run() method in a separate thread.
*/
public class JSRunnable implements Runnable {
private JSObject runnable;
public JSRunnable(JSObject runnable) {
this.runnable = runnable;
synchronized(this) {
new Thread(this).start();
try {
this.wait();
} catch (InterruptedException ie) {
}
}
}
public void run() {
try {
runnable.call("run", null);
synchronized(this) {
notifyAll();
}
} catch (Throwable t) {
System.err.println(t);
t.printStackTrace(System.err);
}
}
}