public Serialize(int numberOfThreads, Func <IMessage, string> getQueueNameFromMessage) { _messages = new NotifyingMultiQueue <ScheduledTask>(); _getQueueNameFromMessage = getQueueNameFromMessage; _waitForWork = new List <Wait_for_work <ScheduledTask> >(); for (var i = 0; i < numberOfThreads; i++) { var wfw = new Wait_for_work <ScheduledTask>(_messages, () => { ScheduledTask result; var success = _messages.TryDequeue(Thread.CurrentThread.GetHashCode().ToString(), out result); return(new Tuple <bool, ScheduledTask>(success, result)); }); wfw.Dequeued += _ => _.ContinueWith(_.Message); _waitForWork.Add(wfw); } }
public Serialize(int numberOfThreads, Func<IMessage,string> getQueueNameFromMessage) { _messages = new NotifyingMultiQueue<ScheduledTask>(); _getQueueNameFromMessage = getQueueNameFromMessage; _waitForWork = new List<Wait_for_work<ScheduledTask>>(); for (var i = 0; i < numberOfThreads; i++) { var wfw = new Wait_for_work<ScheduledTask>(_messages, () => { ScheduledTask result; var success = _messages.TryDequeue(Thread.CurrentThread.GetHashCode().ToString(), out result); return new Tuple<bool, ScheduledTask>(success, result); }); wfw.Dequeued += _ => _.ContinueWith(_.Message); _waitForWork.Add(wfw); } }
public void Before_each_test() { _sut = new NotifyingMultiQueue <string>(); _result = null; }
public void Before_each_test() { _sut = new NotifyingMultiQueue<string>(); _result = null; }