annotate Implab/Safe.cs @ 24:ee04e1fa78da

fixed dispatch pool race condition
author cin
date Thu, 14 Nov 2013 01:15:07 +0400
parents aa367305156b
children dafaadca5b9f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
1 using System;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
2 using System.Collections.Generic;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
3 using System.Linq;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
4 using System.Text;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
5
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
6 namespace Implab
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
7 {
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
8 public static class Safe
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
9 {
2
aa367305156b small fixes
cin
parents: 1
diff changeset
10 public static void Dispose<T>(ref T obj) where T : class
1
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
11 {
2
aa367305156b small fixes
cin
parents: 1
diff changeset
12 var disp = obj as IDisposable;
aa367305156b small fixes
cin
parents: 1
diff changeset
13 if (disp != null)
1
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
14 {
2
aa367305156b small fixes
cin
parents: 1
diff changeset
15 disp.Dispose();
1
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
16 obj = default(T);
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
17 }
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
18 }
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
19 }
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
20 }