Woopsa.CustomThreadPool.Join C# (CSharp) Method

Join() public method

public Join ( System.TimeSpan timeout ) : bool
timeout System.TimeSpan
return bool
        public bool Join(TimeSpan timeout)
        {
            DateTime waitStart = DateTime.Now;
            CustomThreadPoolThread[] threads;
            lock (_threads)
                threads = _threads.ToArray();
            _aborting = true;
            foreach (var item in threads)
            {
                TimeSpan remaining;
                if (timeout != InfiniteTimeSpan)
                {
                    TimeSpan elapsed = DateTime.Now - waitStart;
                    remaining = timeout - elapsed;
                    if (remaining < TimeSpan.Zero)
                        remaining = TimeSpan.Zero;
                }
                else
                    remaining = InfiniteTimeSpan;
                if (!item.Join(remaining))
                    return false;
            }

            return true;
        }

Same methods

CustomThreadPool::Join ( ) : void