http://www.cppblog.com/prayer/archive/2012/04/23/172427.html 这两天在看Pthread 资料的时候,无意中看到这样一句话(man pthread_detach): Either pthread_join(3) or pthread_detach() should be called for each thread that an application creates, so that system resources for the…
/** * @author * * Lock 是java.util.concurrent.locks下提供的java线程锁,作用跟synchronized类似, * 单是比它更加面向对象,两个线程执行代码段要实现互斥效果,他们需要用同一个Lock, * 锁存在资源类的内部中,而不是存在线程上. */ public class ThreadLock { public static void main(String[] args) { final Outputer out = new Outpute…