comparison Implab/ActionTaskBase.cs @ 149:eb793fbbe4ea v2

fixed promises cancellation
author cin
date Wed, 06 May 2015 17:11:27 +0300
parents 706fccb85524
children dd4a3590f9c6
comparison
equal deleted inserted replaced
148:e6d4b41f0101 149:eb793fbbe4ea
6 readonly Action<Exception> m_cancel; 6 readonly Action<Exception> m_cancel;
7 readonly Action<Exception> m_error; 7 readonly Action<Exception> m_error;
8 8
9 int m_cancelationLock; 9 int m_cancelationLock;
10 10
11 protected ActionTaskBase( Action<Exception> error, Action<Exception> cancel) { 11 protected ActionTaskBase( Action<Exception> error, Action<Exception> cancel, bool autoCancellable) {
12 m_error = error; 12 m_error = error;
13 m_cancel = cancel; 13 m_cancel = cancel;
14 if (autoCancellable)
15 CancellationRequested(CancelOperation);
14 } 16 }
15 17
16 public void Reject(Exception error) { 18 public void Reject(Exception error) {
17 Safe.ArgumentNotNull(error, "error"); 19 Safe.ArgumentNotNull(error, "error");
18 if (LockCancelation()) 20 if (LockCancelation())