comparison Implab/TaskController.cs @ 138:f75cfa58e3d4 v2

added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
author cin
date Tue, 17 Feb 2015 18:16:26 +0300
parents c761fc982e1d
children
comparison
equal deleted inserted replaced
137:238e15580926 138:f75cfa58e3d4
97 if (!m_cancelled) 97 if (!m_cancelled)
98 m_cancelled = true; 98 m_cancelled = true;
99 } 99 }
100 } 100 }
101 101
102 public void Cancel(Exception reason) {
103 lock (m_lock) {
104 if (!m_cancelled)
105 m_cancelled = true;
106 }
107 }
108
102 protected virtual void OnCancelled() { 109 protected virtual void OnCancelled() {
103 var temp = Cancelled; 110 var temp = Cancelled;
104 if (temp != null) { 111 if (temp != null) {
105 temp(this,new EventArgs()); 112 temp(this,new EventArgs());
106 } 113 }