monitor 썸네일형 리스트형 (C#) Semaphore Release Queue Q = new Queue(); //쓰레드형으로 큐 선언 private void enterRelease() { if (this.Q.Count > 0) //Q카운터가 0보다크면 Release 쓰레드를 풀어줌 { Thread tempThread = this.Q.Dequeue(); lock (tempThread) { Monitor.Pulse(tempThread); } } else { this.enternumber++; } } 큐 카운터가 0보다 크면 tempThread 에 큐에 들어있는 Thread를 받고 Monitor를 이용해 tempThread를 다시 활성하 해준다 그리고 0 이거나 0보다 작으면 enternumber를 1 증가시켜 줍니다. 그리고 저 lock도 동기화 하는 방식인데 저렇게 해야 .. 더보기 이전 1 다음