各位朋友好,我想用多线程来模仿多用户调用同一个方法测试下其性能,有做过类似需求的朋友给我点意见,有DEMO做好,嘿嘿,非常感谢.
2 回答
德玛西亚99
TA贡献1770条经验 获得超3个赞
[object Object]Code
public void Main() {
Thread[] threads = new Thread[100];
for(int i = 0; i < threads.Length; i++) {
threads[i] = new Thread(new ThreadStart(TestThread));
threads[i].Start();
}
}
private void TestThread() {
//Invoke mothods tested here
//
}大侠,是不是我的做法太“幼稚”了?这样做有哪些不妥的地方?
- 2 回答
- 0 关注
- 819 浏览
添加回答
举报
0/150
提交
取消
