莊周夢蝶

          生活、程序、未來
             :: 首頁 ::  ::  :: 聚合  :: 管理

          保持java線程間可見性的5種方式

          Posted on 2008-02-23 10:44 dennis 閱讀(834) 評(píng)論(1)  編輯  收藏 所屬分類: java
          Primitive Writes up to and including… ...are made visible to…
          Object the end of a synchronized block or method a thread entering a synchronized block or method for the same object.
          Volatile field a write to a volatile field any thread reading that volatile field.
          Thread a call to Thread.start the newly started thread.
          Thread the final write made by a dying thread any thread which successfully calls Thread.join on that thread.
          Final field the initialization of a final field (but only those writes affecting the field and any object it references) any thread, provided that the constructor of the object containing the field doesn’t write the value of this anywhere eventually visible to other threads


            這些在《java并發(fā)編程實(shí)踐》一書中已經(jīng)有詳細(xì)解釋,特別是對(duì)于ReentrantLock、volatile域以及final域的討論。今天在MenTaLguY的blog上看到這張表,摘錄下。

          評(píng)論

          # re: 保持java線程間可見性的5種方式  回復(fù)  更多評(píng)論   

          2008-02-23 16:08 by 魔域私服
          看不懂``````````
          主站蜘蛛池模板: 平邑县| 休宁县| 泗水县| 昆明市| 鹤山市| 盐山县| 垦利县| 略阳县| 迭部县| 佳木斯市| 富裕县| 襄城县| 东兰县| 凤山县| 清新县| 亚东县| 金塔县| 大英县| 京山县| 进贤县| 神池县| 喀什市| 新津县| 肇州县| 拜城县| 永嘉县| 尼勒克县| 潢川县| 日土县| 绍兴市| 来宾市| 东光县| 资溪县| 保康县| 民丰县| 库尔勒市| 萝北县| 鹤岗市| 余江县| 洪泽县| 蒲江县|