/// <summary> /// Start the thread. Note: this method can be called again when /// the thread has called its OnCompletion() handler. /// </summary> public void Start() { Debug.Assert(Status != WorkerStatus.Running); Debug.Assert(InternalThread == null); // Initialize the socket pair once. if (SocketPair == null) { SocketPair = Base.SocketPair(); } // Initialize the variables used once per invocation. MsgQueue = new Queue <WorkerThreadMsg>(); CancelFlag = false; BlockedFlag = false; Status = WorkerStatus.Running; FailException = null; InternalThread = new Thread(InternalRun); InternalThread.Start(); }