Ejemplo n.º 1
0
 /// <summary> Adds a unit of work to the list </summary>
 public void AddWork(WaitAndContinueList list)
 {
     if (_control.HasQuit)
     {
         throw new ObjectDisposedException(GetType().FullName);
     }
     _work.AddWork(list);
     _control.Modified();
 }
Ejemplo n.º 2
0
        /// <summary> Constructs a thread to process IWaitAndContinue work items </summary>
        public WaitAndContinueWorker()
        {
            _control = new WorkerControl();
            _work    = new WaitAndContinueList();
            _work.AddWork(_control);

            _worker = new Thread(Run);
            _worker.SetApartmentState(ApartmentState.MTA);
            _worker.IsBackground = true;
            _worker.Name         = GetType().Name;
            _worker.Start();
        }
Ejemplo n.º 3
0
 /// <summary> Moves the work in the other list into this list </summary>
 public void AddWork(WaitAndContinueList other)
 {
     if (_disposed)
     {
         throw new ObjectDisposedException(GetType().FullName);
     }
     lock (_list)
         lock (other._list)
         {
             Node next = other._list.First;
             while (next != null)
             {
                 Node node = next;
                 next = next.Next;
                 other._list.Remove(node);
                 _list.AddLast(node);
             }
         }
 }