static void Main(string[] args) { var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); var ctx = new CancellationTokenSource(); List <Wallet> walletList = new List <Wallet>(); walletList.Add(new Wallet("Alice")); walletList.Add(new Wallet("Bob")); walletList.Add(new Wallet("Test1")); Mixer mixer = new Mixer(walletList); TransactionProcessor tp = new TransactionProcessor(mixer.OnNewTransaction); RequestResponse rr = new RequestResponse(ctx, tp); Task t = Task.Factory.StartNew(rr.PollTransactions, ctx.Token, TaskCreationOptions.LongRunning, TaskScheduler.Current); Console.WriteLine("Press any key to end this coin mixer program..."); Console.ReadKey(); ctx.Cancel(); t.Wait(ctx.Token); }
public RequestResponse(CancellationTokenSource ctx, TransactionProcessor tp) { _ctx = ctx; _tp = tp; }