diff Implab/Parallels/AsyncPool.cs @ 35:2880242f987a diagnostics

initial log capabilities
author cin
date Mon, 14 Apr 2014 18:25:26 +0400
parents 9bf5b23650c9
children 313f708a50e9
line wrap: on
line diff
--- a/Implab/Parallels/AsyncPool.cs	Thu Apr 10 04:20:25 2014 +0400
+++ b/Implab/Parallels/AsyncPool.cs	Mon Apr 14 18:25:26 2014 +0400
@@ -1,3 +1,4 @@
+using Implab.Diagnostics;
 using System;
 using System.Threading;
 
@@ -13,8 +14,10 @@
 
 		public static Promise<T> Invoke<T>(Func<T> func) {
 			var p = new Promise<T>();
+            var caller = LogContext.Current;
 
 			ThreadPool.QueueUserWorkItem(param => {
+                Log.Transfer(caller);
 				try {
 					p.Resolve(func());
 				} catch(Exception e) {
@@ -28,7 +31,10 @@
         public static Promise<T> InvokeNewThread<T>(Func<T> func) {
             var p = new Promise<T>();
 
+            var caller = LogContext.Current;
+
             var worker = new Thread(() => {
+                Log.Transfer(caller);
                 try {
                     p.Resolve(func());
                 } catch (Exception e) {