public void Start(TransactionQueue tsacs) { WaitCallback callBack; System.Diagnostics.Debug.WriteLine("Setting minimum threads for pool"); System.Threading.ThreadPool.SetMinThreads(10, 10); TransactionQueue splitchunk = new TransactionQueue(); callBack = new WaitCallback(ProcessBatch); MasterAccount = tsacs.Queue[0].AccountFrom; for (int i = 1; i <= tsacs.Queue.Count; i++) { splitchunk.Add(tsacs.Queue[i - 1]); if (i % 500 == 0 || i == tsacs.Queue.Count) { splitchunk.BatchID = tsacs.BatchID; System.Threading.ThreadPool.QueueUserWorkItem(callBack, (object)splitchunk); splitchunk = null; splitchunk = new TransactionQueue(); } } }
public bool Add(Transaction trans) { BnkQueue.Add(trans); return(true); }