コード例 #1
0
ファイル: Serialize.cs プロジェクト: kouweizhong/NPantaRhei
        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);
            }
        }
コード例 #2
0
ファイル: Serialize.cs プロジェクト: kennychou0529/NPantaRhei
        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);
            }
        }
コード例 #3
0
 public void Before_each_test()
 {
     _sut    = new NotifyingMultiQueue <string>();
     _result = null;
 }
コード例 #4
0
 public void Before_each_test()
 {
     _sut = new NotifyingMultiQueue<string>();
     _result = null;
 }