/// <summary> /// Starts the underlying <see cref="Thread"/>. /// </summary> internal void Start() { if ((SystemThread.ThreadState & ThreadState.Unstarted) != 0) { SystemThread.Start(); } }
/// <summary> /// Sends a termination signal to the underlying <see cref="Thread"/>, and waits for it to exit. /// </summary> internal void Terminate() { _continueWorking = false; if (SystemThread.IsAlive) { SystemThread.Join(); } }
public ThreadingTests() { _threadPool = new Threading.ThreadPool(); SystemThread _systemThread = new SystemThread { Name = "Process 1", Id = Guid.NewGuid() }; _systemThread.Resources.Add(_resourceA); _threadPool.Add(_systemThread); _systemThread = new SystemThread { Name = "Process 2", Id = Guid.NewGuid() }; _systemThread.Resources.Add(_resourceB); _threadPool.Add(_systemThread); _systemThread = new SystemThread { Name = "Process 3", Id = Guid.NewGuid() }; _systemThread.Resources.Add(_resourceA); _systemThread.Resources.Add(_resourceB); _threadPool.Add(_systemThread); _systemThread = new SystemThread { Name = "Process 4", Id = Guid.NewGuid() }; _systemThread.Resources.Add(_resourceC); _threadPool.Add(_systemThread); _systemThread = new SystemThread { Name = "Process 5", Id = Guid.NewGuid() }; _systemThread.Resources.Add(_resourceB); _threadPool.Add(_systemThread); _threadPool.RunAll(); Thread.Sleep(6000); }