📄 class1.cs
字号:
using System;
using System.Threading ;
namespace WorkQueue
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
new Thread(new ThreadStart(Test.dodo)).Start();
//Console.WriteLine("start");
WorkQueue wq = new WorkQueue(2);
Thread.Sleep(1000);
for(int i=0;i<100;i++)
{
wq.execute(
new Thread(new ThreadStart((new Test(i)).dodo2))
);
}
Console.WriteLine("ok");
}
class Test
{
int ii;
public Test(){}
public Test(int i){ii=i;}
public static void dodo()
{
System.Console.Write("--{0}-\n",10);
}
public void dodo2()
{
System.Console.Write("--{0}-\n",ii);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -