Mercurial > pub > ImplabNet
comparison Implab/Promise.cs @ 1:6fb3b01ee971
Added utility class for safe disposing methods.
Added event fireing while promise is cancelled (needs some more work)
| author | cin |
|---|---|
| date | Tue, 27 Aug 2013 08:28:42 +0400 |
| parents | 279591fb4df3 |
| children | aa367305156b |
comparison
equal
deleted
inserted
replaced
| 0:279591fb4df3 | 1:6fb3b01ee971 |
|---|---|
| 126 /// <returns><c>true</c> Операция была отменена, обработчики не будут вызваны.<c>false</c> отмена не возможна, поскольку обещание уже выполнено и обработчики отработали.</returns> | 126 /// <returns><c>true</c> Операция была отменена, обработчики не будут вызваны.<c>false</c> отмена не возможна, поскольку обещание уже выполнено и обработчики отработали.</returns> |
| 127 public bool Cancel() { | 127 public bool Cancel() { |
| 128 lock(this) { | 128 lock(this) { |
| 129 if (m_state == State.Unresolved && m_cancellable) { | 129 if (m_state == State.Unresolved && m_cancellable) { |
| 130 m_state = State.Cancelled; | 130 m_state = State.Cancelled; |
| 131 EventHandler temp = Cancelled; | |
| 132 | |
| 133 if (temp != null) | |
| 134 temp(this,new EventArgs()); | |
| 135 | |
| 131 return true; | 136 return true; |
| 132 } else | 137 } else |
| 133 return false; | 138 return false; |
| 134 } | 139 } |
| 135 } | 140 } |
