diff Implab/SyncContextPromise.cs @ 192:f1da3afc3521 release v2.1

Слияние с v2
author cin
date Fri, 22 Apr 2016 13:10:34 +0300
parents 97fbbf816844
children 3eb3255d8cc5
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab/SyncContextPromise.cs	Fri Apr 22 13:10:34 2016 +0300
@@ -0,0 +1,18 @@
+using System.Threading;
+using System;
+
+namespace Implab {
+    public class SyncContextPromise<T> : Promise<T> {
+        readonly SynchronizationContext m_context;
+
+        public SyncContextPromise(SynchronizationContext context) {
+            Safe.ArgumentNotNull(context, "context");
+            m_context = context;
+        }
+
+        protected override void SignalHandler(HandlerDescriptor handler, int signal) {
+            m_context.Post(x => base.SignalHandler(handler, signal), null);
+        }
+    }
+}
+