Siemens TC45 User Manual page 69

Cellular engine
Hide thumbs Also See for TC45:
Table of Contents

Advertisement

TC45 TC45 JAVA User's Guide
Confidential / Released
System.out.println("Thread(" + loops + "): Loop " + i);
try {
Thread.sleep(1000);
} catch(InterruptedException e) {
System.out.println(e);
}
}
System.out.println("Thread(" + loops + "): Finished naturally");
}
}
/**
* ThreadDemo - constructor
*/
public ThreadDemo() {
System.out.println("ThreadDemo: Constructor, creating threads");
thread1 = new DemoThread(2);
thread2 = new DemoThread(6);
}
/**
* startApp()
*/
public void startApp() throws MIDletStateChangeException {
System.out.println("ThreadDemo: startApp, starting threads");
thread1.start();
thread2.start();
System.out.println("ThreadDemo: Waiting 4 seconds before stopping threads");
try {
Thread.sleep(4000);
} catch(InterruptedException e) {
System.out.println(e);
}
destroyApp(true);
System.out.println("ThreadDemo: Closing application");
notifyDestroyed();
}
/**
* pauseApp()
*/
public void pauseApp() {
System.out.println("ThreadDemo: pauseApp()");
}
/**
* destroyApp()
*/
public void destroyApp(boolean cond) {
System.out.println("ThreadDemo: destroyApp(" + cond + ")");
System.out.println("ThreadDemo: Stopping threads from outsdide");
runThreads = false;
try {
System.out.println("ThreadDemo: Waiting for threads to die");
thread1.join();
thread2.join();
} catch(InterruptedException e) {
System.out.println(e);
}
System.out.println("ThreadDemo: All threads died");
}
}
TC45_JAVA User's Guide_V02
Page 69 of 72
30.06.2003

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents