##// END OF EJS Templates
Added utility class for safe disposing methods....
cin -
r1:6fb3b01ee971 default
parent child
Show More
@@ -0,0 +1,19
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace Implab
7 {
8 public static class Safe
9 {
10 public static void Dispose<T>(ref T obj) where T : IDisposable
11 {
12 if (obj != null)
13 {
14 obj.Dispose();
15 obj = default(T);
16 }
17 }
18 }
19 }
@@ -127,7 +127,12 namespace Implab {
127 127 public bool Cancel() {
128 128 lock(this) {
129 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 136 return true;
132 137 } else
133 138 return false;
General Comments 0
You need to be logged in to leave comments. Login now