Update Java_并发编程.md

This commit is contained in:
heibaiying 2020-03-10 16:19:10 +08:00 committed by GitHub
parent 43a326d3f3
commit e73d5fd4df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -576,7 +576,7 @@ public class J4_SynchronizedSafe {
@Override
public void run() {
for (int j = 0; j < 100000; j++) {
// 虽然调用的是不同的 IncreaseTask() 例,但锁住的仍然是同一个对象,此时也是线程安全的
// 虽然调用的是不同的 IncreaseTask() 例,但锁住的仍然是同一个对象,此时也是线程安全的
synchronized (s) {
i++;
}