多线程
Deep_Mind
good good study, day day up.
展开
-
你以为在java里用synchronized就能万事大吉了吗?
我们先来想想,synchronized的功能:1.同步,搞互斥锁,使线程不能交叉执行;2.维护共享变量在多个线程之间的可见性;public class demo { private boolean ready=false; private int result=0; private int number=1; public synchronized void write(){原创 2016-07-28 10:37:10 · 1096 阅读 · 4 评论 -
Thread继承类中的run()方法和start()方法的区别
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package com.myt原创 2016-08-29 21:27:43 · 2882 阅读 · 0 评论