......
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]
为什么有警告输出?
你代码写错了哦,while(Thread.activeCount() < 1),是活跃的线程数量小于1,你写成大于号啦