コード例 #1
0
        /// <summary>
        /// 超时切换任务线程集合
        /// </summary>
        /// <param name="config"></param>
        internal TaskSwitchThreadArray(TaskSwitchThreadConfig config) : base(config)
        {
            int threadCount = config.GetThreadCount;

            CurrentThread = CreateThread();
            if (threadCount != 1)
            {
                threads    = new T[threadCount];
                threads[0] = CurrentThread;
                createLock = new object();

                int milliseconds = config.SwitchThreadMilliseconds;
                timer = new System.Threading.Timer(check, null, milliseconds, milliseconds);
            }
        }
コード例 #2
0
 /// <summary>
 /// 超时切换任务线程集合
 /// </summary>
 /// <param name="config"></param>
 protected TaskSwitchThreadArrayBase(TaskSwitchThreadConfig config)
 {
     switchTimestamp   = Date.GetTimestampByMilliseconds(config.GetSwitchThreadMilliseconds);
     NoSwitchTimestamp = long.MaxValue - switchTimestamp;
 }