Wait() public method

Waits for specified worker thread to finish.
public Wait ( Thread workerThread ) : bool
workerThread Thread The worker thread.
return bool
Exemplo n.º 1
0
        /// <summary>
        /// Stops a thread by aborting it if configured to do; otherwise it will wait (forever if needed) until the thread dies.
        /// </summary>
        /// <param name="workerThread">The worker thread.</param>
        /// <returns></returns>
        public bool TryForceTerminate(Thread workerThread)
        {
            if (_abortWorkerThread.Abort(workerThread))
            {
                return(true);
            }

            //wait for the thread to exit
            _waitForThreadToFinish.Wait(workerThread);

            return(true);
        }