HTML/JavaScript小工具

HTML/JavaScript小工具

2013年5月8日 星期三

Thread狀態


Thread thread1=new Thread(new ExtendThread(), "thread1 "); Thread thread2=new Thread(thread1, "thread2 "); thread1.start();
thread2.start();

thread1.start();       // START

這會拋出錯誤訊息IllegalMonitorStateException 

因為Thread已進入
所以到了RUNNABLE狀態,start只有New狀態下才可呼叫


Thread有以下幾種狀態
NEW
RUNNABLE
BLOCKED
WAITING
TIMED_WAITING
TERMINATED


沒有留言:

張貼留言