My Java Blog Park

          線程同步隨記

          1. wait:
          ?? Causes current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object
          ?? This method should only be called by a thread that is the owner of this object's monitor

          ?? 使當前線程放棄對象鎖(等待?),直到其它線程為該對象調用notify()或notifyAll().
          ?? 這個方法只能被擁有對象鎖(監聽器?)的線程執行。
          ??
          ??
          2. notify,notifyAll
          ?? Wakes up a or all threads that are waiting on this object's monitor.
          ??
          ?? 喚醒正在等待指定對象的鎖的一個或所有線程。

          -- 這樣翻譯也不知是否準確,括號內是按直譯過來的意思。

          3. 四種方式?
          ?? 1.static synchronized method(){}
          ?? 2.sychronized(Class)
          ?? 3.sychronized method(){}
          ?? 4.sychronized() {}

          4.? 書上沒說過的: Spin? Lock (旋轉鎖)

          posted on 2006-07-25 14:53 2195113 閱讀(182) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 巩留县| 西华县| 社会| 资中县| 玉门市| 盐边县| 福鼎市| 通江县| 舒城县| 金沙县| 古交市| 佛冈县| 绩溪县| 连江县| 肥城市| 铜川市| 彝良县| 西安市| 泽库县| 新疆| 金沙县| 县级市| 梅州市| 宝丰县| 万载县| 赤峰市| 鲜城| 宾川县| 冷水江市| 双辽市| 芒康县| 远安县| 清徐县| 泗水县| 广汉市| 西宁市| 明光市| 柘荣县| 徐闻县| 广宁县| 泾阳县|