Thread.activeCount()運行出錯問題
......
? ? System.out.println(Thread.activeCount());
? ? while (Thread.activeCount() > 1) {
? ? ? Thread.yield();
? ? }
? ? System.out.println(t.getNum());
按照教程中寫的代碼
打印結果:
877
1000
FATAL ERROR in native method: JDWP cannot get thread local storage, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)
JDWP exit error JVMTI_ERROR_WRONG_PHASE(112): cannot get thread local storage [../../../src/share/back/threadControl.c:195]
為什么有警告輸出?
2016-01-14
你代碼寫錯了哦,while(Thread.activeCount() < 1),是活躍的線程數量小于1,你寫成大于號啦