Thread类中currentThread()方法的定义- public static native Thread currentThread();
- /**
- * A hint to the scheduler that the current thread is willing to yield
- * its current use of a processor. The scheduler is free to ignore this
- * hint.
- *
- * <p> Yield is a heuristic attempt to improve relative progression
- * between threads that would otherwise over-utilise a CPU. Its use
- * should be combined with detailed profiling and benchmarking to
- * ensure that it actually has the desired effect.
- *
- * <p> It is rarely appropriate to use this method. It may be useful
- * for debugging or testing purposes, where it may help to reproduce
- * bugs due to race conditions. It may also be useful when designing
- * concurrency control constructs such as the ones in the
- * {@link java.util.concurrent.locks} package.
复制代码 获取线程对象的引用调用的是本地的方法,我感觉或许是因为系统的不同得到的信息不太一样
5代表的是线程的优先级 后边那个main就不清楚了
希望能帮到你 共同学习哈 |