动态效果.pptVIP

  • 6
  • 0
  • 约6.61千字
  • 约 56页
  • 2016-08-17 发布于海南
  • 举报
动态效果

Chapter 8 线程Threads 主要内容 什么是线程 定义线程 使用线程 多线程同步问题 wait 与 notify 同步synchronized Three Parts of a Thread CPU Code Data Creating the Thread Thread生命期 Thread 类定义 终止 Thread 1 public class Runner implements Runnable { 2 private boolean timeToQuit=false; 3 4 public void run() { 5 while ( ! timeToQuit ) { 6 ... 7 } 8 // clean up before run() ends 9 } 10 11 public void stopRunning() { 12 timeToQuit=true; 13 } 14 } Basic Control of Threads Threads检测: isAlive() Thread 优先级: getPriority() setPriority() threads 控制: start() Thread.sleep() join() Thread.yield() Putting Threads on Hold I Putti

文档评论(0)

1亿VIP精品文档

相关文档