KiloWatt.Runtime.Support.ThreadPoolComponent.WorkOne C# (CSharp) Method

WorkOne() private method

private WorkOne ( ) : void
return void
        void WorkOne()
        {
            Worker w = null;
              workEvent_.WaitOne();
              if (disposed_)
              {
            workEvent_.Set();   //  tell the next guy through
            return;
              }
              lock (this)
              {
            w = workList_;
            if (w != null)
            {
              workList_ = w.next_;
              if (workList_ == null)
            workListEnd_ = null;
              else
            workEvent_.Set();   //  tell the next guy through
              w.next_ = null;
            }
            else
              return;
              }
              try
              {
            w.function_();
              }
              catch (System.Exception x)
              {
            w.error_ = x;
              }
              lock (this)
              {
            if (disposed_ && w.error_ == null)
              w.error_ = new System.ObjectDisposedException("ParallelThreadPool");
            if (completeList_ == null)
              completeList_ = w;
            else
              completeListEnd_.next_ = w;
            completeListEnd_ = w;
            --qDepth_;
            if (w.context_ != null)
              w.context_.Complete();
              }
        }