diff Implab/PromiseExtensions.cs @ 109:1b7ebcc52e5a v2

minor fixes
author cin
date Fri, 14 Nov 2014 14:04:24 +0300
parents 5f10d54b45df
children 1a8426e6e895
line wrap: on
line diff
--- a/Implab/PromiseExtensions.cs	Tue Nov 11 18:37:35 2014 +0300
+++ b/Implab/PromiseExtensions.cs	Fri Nov 14 14:04:24 2014 +0300
@@ -1,5 +1,8 @@
 using System.Threading;
 using System;
+using Implab.Diagnostics;
+
+
 #if NET_4_5
 using System.Threading.Tasks;
 #endif
@@ -57,11 +60,15 @@
         public static AsyncCallback AsyncCallback<T>(this Promise<T> that, Func<IAsyncResult,T> callback) {
             Safe.ArgumentNotNull(that, "that");
             Safe.ArgumentNotNull(callback, "callback");
+            var op = TraceContext.Instance.CurrentOperation;
             return ar => {
+                TraceContext.Instance.EnterLogicalOperation(op,false);
                 try {
                     that.Resolve(callback(ar));
                 } catch (Exception err) {
                     that.Reject(err);
+                } finally {
+                    TraceContext.Instance.Leave();
                 }
             };
         }