Page History
...
- 비동기 : 다른 녀석에게 일을 넘기고 내일을 한다. ( 논블럭킹)
- 동기 : 다른 녀석이 일을 마칠때까지 기다린다. ( 블럭킹 )
- 능동적 : 나만의 큐와 스케쥴러를 가지고 있음
- 패턴의 탄생이유로 알아보는 디자인패턴에대한 이해
OOP와 비교해본 Actor Model
OOP
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public class DeepThought { private int state; public int State { get { lock (this) { Thread.Sleep(3000); //나의 상태에대한 깊은 생각에 빠짐.. return state; } } set { lock (this) { //깊은 생각에 빠질땐 누구도 건들지 말기를 바람,그대가 멀티쓰레드라 할지라도 state = value; } } } } var dt = new DeepThought() Thread.new { console.log( dt.State ) } Thread.new { dt.State=1 } |
...