changeset 213:9ee78a345738 v2

Minor code changes
author cin
date Tue, 11 Apr 2017 01:35:18 +0300
parents a01d9df88d74
children 9c32ef39b851
files Implab/Components/Disposable.cs Implab/Safe.cs
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Implab/Components/Disposable.cs	Tue Apr 04 12:04:05 2017 +0300
+++ b/Implab/Components/Disposable.cs	Tue Apr 11 01:35:18 2017 +0300
@@ -8,7 +8,7 @@
     /// Base class the objects which support disposing.
     /// </summary>
     public class Disposable : IDisposable {
-        
+
         int m_disposed;
 
         public event EventHandler Disposed;
@@ -75,11 +75,9 @@
         /// из нескольких потоков.
         /// </remarks>
         protected virtual void Dispose(bool disposing) {
-            if (disposing) {
-                EventHandler temp = Disposed;
-                if (temp != null)
-                    temp(this, EventArgs.Empty);
-            }
+            if (disposing)
+                Disposed.DispatchEvent(this, EventArgs.Empty);
+
         }
 
         [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Dipose(bool) and GC.SuppessFinalize are called")]
--- a/Implab/Safe.cs	Tue Apr 04 12:04:05 2017 +0300
+++ b/Implab/Safe.cs	Tue Apr 11 01:35:18 2017 +0300
@@ -6,6 +6,10 @@
 using System.Diagnostics;
 using System.Collections;
 
+#if NET_4_5
+using System.Threading.Tasks;
+#endif
+
 namespace Implab
 {
     public static class Safe
@@ -117,6 +121,9 @@
             }
         }
 
+        public static void NoWait(IPromise promise) {
+        }
+
         [DebuggerStepThrough]
         public static IPromise<T> Run<T>(Func<IPromise<T>> action) {
             ArgumentNotNull(action, "action");
@@ -128,5 +135,10 @@
             }
         }
 
+#if NET_4_5
+        public static void NoWait(Task t) {
+        }
+#endif
+
     }
 }