示例#1
0
 public void Produce(CancellationToken token)
 {
     while (!token.IsCancellationRequested)
     {
         Thread.Sleep(randy.Next(1, 2000));
         var transferItem = new TransferInitializer()
         {
             Id          = Guid.NewGuid(),
             Name        = "One Production Item",
             TransferUrl = "http://google.com"
         };
         EnqueueTransfer(transferItem);
     }
 }
示例#2
0
 public void Produce(CancellationToken token)
 {
     while (!token.IsCancellationRequested)
     {
         Thread.Sleep(randy.Next(1, 2000));
         var transferItem = new TransferInitializer()
         {
             Id = Guid.NewGuid(),
             Name = "One Production Item",
             TransferUrl = "http://google.com"
         };
         EnqueueTransfer(transferItem);
     }
 }
示例#3
0
 private void EnqueueTransfer(TransferInitializer transferItem)
 {
     TransferQueue.Instance.Add(transferItem);
     Console.WriteLine("{2} -------> Produced {0} - {1}. [thread #{3}]", transferItem.Id, transferItem.Name, TransferQueue.Count.ToString().PadLeft(3), System.Threading.Thread.CurrentThread.ManagedThreadId);
 }
示例#4
0
 private void EnqueueTransfer(TransferInitializer transferItem)
 {
     TransferQueue.Instance.Add(transferItem);
     Console.WriteLine("{2} -------> Produced {0} - {1}. [thread #{3}]", transferItem.Id, transferItem.Name, TransferQueue.Count.ToString().PadLeft(3), System.Threading.Thread.CurrentThread.ManagedThreadId);
 }