annotate Implab/Safe.cs @ 14:e943453e5039 promises

Implemented interllocked queue fixed promise syncronization
author cin
date Wed, 06 Nov 2013 17:49:12 +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 }