Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
话题被移动
该话题已被移动 - littledeer1974 , 2004-10-29 13:52
如果您尚不清楚该话题被移动的原因,请参考论坛规则以及本版公告或者联系本版版主。
作者 Re:wait() and notify() [Re:daywalker]
kingwzb





发贴: 106
积分: 0
于 2003-10-12 22:01 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
严重同意dog72,在这里我总结几条Java多线程用法:
1.sycronized关键字是给对象加锁。
2.wait,notify操作是在操作对象锁的机制上实现同步,故它们只能在sycronized语句块中使用。
3.sleep不会释放锁。
4.wait操作会释放锁。
5.notify是唤醒一个等待锁的线程,若没有等待的线程,则不做任何事。
6.sleep能使较低优先级和较高优先级线程有执行机会,而yield只能使同优先级线程获得执行机会!
7.不要使用已被标为废弃的resume,stop,suspend,因为它们会导致死锁。




话题树型展开
人气 标题 作者 字数 发贴时间
6392 wait() and notify() daywalker 838 2003-09-26 21:23
5355 Re:wait() and notify() java8964 148 2003-09-26 23:28
5165 Re:wait() and notify() lemon2000 46 2003-10-29 11:26
5368 Re:wait() and notify() daywalker 30 2003-09-27 08:15
5317 Re:wait() and notify() lemon2000 200 2003-09-29 10:32
7827 Re:wait() and notify() dog72 369 2003-10-09 16:00
5267 Re:wait() and notify() dog72 114 2003-09-29 10:51
5212 Re:wait() and notify() dog72 30 2003-10-09 13:30
5464 Re:wait() and notify() Biubiu 170 2003-10-09 13:40
5222 Re:wait() and notify() java_archon 213 2003-10-09 20:09
5199 Re:wait() and notify() lemon2000 2 2003-10-10 12:43
5943 Re:wait() and notify() kingwzb 273 2003-10-12 22:01

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923