[게임서버] 메모리 배리어(Memory Barrier)란?
·
공부/게임 서버
C#으로 작성되었습니다. using System; namespace ServerStudy { class Program { static int x = 0; static int y = 0; static int r1 = 0; static int r2 = 0; static void Thread_1() { y = 1; r1 = x; } static void Thread_2() { x = 1; r2 = y; } static void Main(string[] args) { int count = 0; while (true) { count++; x = y = r1 = r2 = 0; Task t1 = new Task(Thread_1); Task t2 = new Task(Thread_2); t1.Start(); t2.Sta..