JAVA_10线程new程序.ppt

* 线程分组示例 ThreadGroup tg = new ThreadGroup(My Group);?? ??????? MyThread thrd = new MyThread(tg, MyThread #1);?? ??????? MyThread thrd2 = new MyThread(tg, MyThread #2);?? ??????? MyThread thrd3 = new MyThread(tg, MyThread #3);?? * ThreadGroup 类 ThreadGroup 类的方法: Collection Management Methods:activeCount ,listCurrentThreads Methods that Operate on the Group: getMaxPriority ,getName Methods that Operate on All Threads within a Group:resume ,stop,suspend Access Restriction Methods:checkAccess * 资源冲突 多个线程同时运行虽然可以提高程序的执行效率,但由于共享一组资源,可能会产生冲突。 * class UserThread{ void Play(int n

文档评论(0)

1亿VIP精品文档

相关文档