Page History
...
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 } |
...