@@ -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 | } |
@@ -128,6 +128,11 namespace Implab { | |||
|
128 | 128 | lock(this) { |
|
129 | 129 | if (m_state == State.Unresolved && m_cancellable) { |
|
130 | 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