##// END OF EJS Templates
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()' added Safe.Dispose(IEnumerable) added PromiseExtensions.CancellationPoint to add a cancellation point to the chain of promises added IPromise<T> PromiseExtensions.Then<T>(this IPromise<T> that, Action<T> success) overloads added PromiseExtensions.Error() overloads to handle a error or(and) a cancellation

File last commit:

r201:d7cd7a83189a v2
r207:558f34b2fb50 v2
Show More
Program.cs
45 lines | 1.2 KiB | text/x-csharp | CSharpLexer
using Implab;
using Implab.Parallels;
using Implab.Diagnostics;
using System.Threading;
namespace MonoPlay {
class MainClass {
public static void Main(string[] args) {
var pool = new WorkerPool(10);
var listerner = new ConsoleTraceListener();
listerner.Subscribe<TraceEvent>();
TraceLog.StartLogicalOperation("Main");
var d = pool.Invoke(() => {
TraceLog.StartLogicalOperation("Worker");
Thread.Sleep(100);
TraceLog.TraceInformation("worker done");
TraceLog.EndLogicalOperation();
});
var op = TraceContext.Instance.CurrentOperation;
ThreadPool.QueueUserWorkItem((o) => {
TraceContext.Instance.EnterLogicalOperation(op, false);
TraceLog.StartLogicalOperation("Thread");
Thread.Sleep(100);
TraceLog.TraceInformation("thread done");
TraceLog.EndLogicalOperation();
});
TraceLog.TraceInformation("main done");
TraceLog.EndLogicalOperation();
d.Join();
}
}
}