コード例 #1
0
ファイル: DirPerfStat.cs プロジェクト: ox1111/Kexplorer
        //-----------------------------------------------------------------------------//
        /// <summary>
        /// Do the work in a separate thread, monitor the time it takes, and kill it if
        /// it takes too long.
        /// </summary>
        /// <returns></returns>
        private DirectoryInfo[] ThreadMonitoredGetDirectories(DirectoryInfo startDir)
        {
            GetDirectoryiesThread dirThread = new GetDirectoryiesThread(startDir);


            dirThread.Start();

            DateTime startTime = DateTime.Now;

            while (dirThread.WorkingDirInfoArr == null)
            {
                Thread.Sleep(1);

                if (DateTime.Now.Subtract(startTime).Ticks > this.tickTimeOut)
                {
                    dirThread.Abort();
                    this.getDirectoiesThreadAbortCount++;
                    break;
                }
            }

            return(dirThread.WorkingDirInfoArr);
        }
コード例 #2
0
ファイル: DirPerfStat.cs プロジェクト: kcsampson/Kexplorer
		//-----------------------------------------------------------------------------//
		/// <summary>
		/// Do the work in a separate thread, monitor the time it takes, and kill it if
		/// it takes too long.
		/// </summary>
		/// <returns></returns>
		private DirectoryInfo[] ThreadMonitoredGetDirectories( DirectoryInfo startDir )
		{
			GetDirectoryiesThread dirThread = new GetDirectoryiesThread( startDir);


			dirThread.Start();

			DateTime startTime = DateTime.Now;
			while ( dirThread.WorkingDirInfoArr == null )
			{
				Thread.Sleep(1);

				if (DateTime.Now.Subtract(startTime).Ticks > this.tickTimeOut) 
				{
					dirThread.Abort();
					this.getDirectoiesThreadAbortCount++;
					break;
				}

			}

			return dirThread.WorkingDirInfoArr;
			 


		}