동기화 (1) 썸네일형 리스트형 자바 동기화, 어설프게 아는 사람이 더 무섭다(java synchronized에 대한 착각, thread-safe) '동기화'문제로 고민한 썰 동기화 문제 이펙티브 자바를 읽던 중, 아이템 78에 있는 자바 동기화 문제로 다양한 상상(?)을 했던 썰을 풀려고 합니다. import java.util.concurrent.TimeUnit; public class Main { private static boolean stopRequested; public static void main(String[] args) throws InterruptedException{ System.out.println("hello world!"); Thread backgroundThread = new Thread(() -> { int i=0; while(!stopRequested){ i++; } }); backgroundThread.start();.. 이전 1 다음