| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- namespace StressClient
- {
- public class ConnectionManager
- {
- // 线程列表
- List<Thread> _thread_list;
- public ConnectionManager()
- {
- _thread_list = new List<Thread>();
- }
- public void Add(Thread thread)
- {
- _thread_list.Add(thread);
- }
- public void Stop()
- {
- try
- {
- // 结束各线程
- foreach (Thread oneThread in _thread_list)
- {
- oneThread.Abort();
- }
- }
- catch (Exception)
- {
- // ignored
- }
- }
- }
- }
|