package com.oldratlee.fucking.concurrency;

import com.oldratlee.fucking.concurrency.util.Utils;

/**
 * @author ding.lid
 */
public class NoPublishDemo {
    boolean stop = false;

    public static void main(String[] args) {
        // LoadMaker.makeLoad();

        NoPublishDemo demo = new NoPublishDemo();

        Thread thread = new Thread(demo.getConcurrencyCheckTask());
        thread.start();

        Utils.sleep(1000);
        System.out.println("Set stop to true in main!");
        demo.stop = true;
        System.out.println("Exit main.");
    }

    ConcurrencyCheckTask getConcurrencyCheckTask() {
        return new ConcurrencyCheckTask();
    }

    private class ConcurrencyCheckTask implements Runnable {
        @Override
        public void run() {
            System.out.println("ConcurrencyCheckTask started!");
            // 如果主线中stop的值可见，则循环会退出。
            // 在我的开发机上，几乎必现循环不退出！（解法：在running属性上加上volatile）
            while (!stop) {
            }
            System.out.println("ConcurrencyCheckTask stopped!");
        }
    }
}

@@ -102,24 +102,238 @@
 %0A * 
-@author ding.lid
+%3Ca href=%22http://hllvm.group.iteye.com/group/topic/34932%22%3E%E8%AF%B7%E9%97%AER%E5%A4%A7 %E6%9C%89%E6%B2%A1%E6%9C%89%E4%BB%80%E4%B9%88%E5%B7%A5%E5%85%B7%E5%8F%AF%E4%BB%A5%E6%9F%A5%E7%9C%8B%E6%AD%A3%E5%9C%A8%E8%BF%90%E8%A1%8C%E7%9A%84%E7%B1%BB%E7%9A%84c/%E6%B1%87%E7%BC%96%E4%BB%A3%E7%A0%81%3C/a%3E%E6%8F%90%E5%88%B0%E4%BA%86%3Cb%3E%E4%BB%A3%E7%A0%81%E6%8F%90%E5%8D%87%3C/b%3E%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82%0A *%0A * @author ding.lid%0A * @see %3Ca href=%22http://hllvm.group.iteye.com/group/topic/34932%22%3E%E8%AF%B7%E9%97%AER%E5%A4%A7 %E6%9C%89%E6%B2%A1%E6%9C%89%E4%BB%80%E4%B9%88%E5%B7%A5%E5%85%B7%E5%8F%AF%E4%BB%A5%E6%9F%A5%E7%9C%8B%E6%AD%A3%E5%9C%A8%E8%BF%90%E8%A1%8C%E7%9A%84%E7%B1%BB%E7%9A%84c/%E6%B1%87%E7%BC%96%E4%BB%A3%E7%A0%81%3C/a%3E
 %0A */

add info in javadoc