Mercurial > pub > ImplabNet
comparison Implab/Parallels/WorkerPool.cs @ 40:fe33f4e02ad5
improved tracing
added text listeners (file,console)
author | cin |
---|---|
date | Tue, 15 Apr 2014 17:52:09 +0400 |
parents | 313f708a50e9 |
children | 4f20870d0816 |
comparison
equal
deleted
inserted
replaced
39:6498078ae368 | 40:fe33f4e02ad5 |
---|---|
40 if (IsDisposed) | 40 if (IsDisposed) |
41 throw new ObjectDisposedException(ToString()); | 41 throw new ObjectDisposedException(ToString()); |
42 | 42 |
43 var promise = new Promise<T>(); | 43 var promise = new Promise<T>(); |
44 | 44 |
45 var caller = TraceContext.Current; | 45 var caller = TraceContext.Snapshot(); |
46 | 46 |
47 EnqueueTask(delegate() { | 47 EnqueueTask(delegate() { |
48 TraceLog.Transfer(caller); | 48 caller.Invoke(delegate() { |
49 try { | 49 try { |
50 promise.Resolve(task()); | 50 promise.Resolve(task()); |
51 } catch (Exception e) { | 51 } catch (Exception e) { |
52 promise.Reject(e); | 52 promise.Reject(e); |
53 } | 53 } |
54 }); | |
54 }); | 55 }); |
55 | 56 |
56 return promise; | 57 return promise; |
57 } | 58 } |
58 | 59 |