小弟c#初学者,问一下各位大侠
using System;
using System.Threading;
namespace ThreadTest
{
public class Alpha
{
public void Beta()
{ for (int i = 0; ;i++ )
{ Console.WriteLine("{0}", i); }
}
};
public class Simple
{
public static int Main()
{
Console.WriteLine("Thread Start/Stop/Join Sample");
Alpha oAlpha = new Alpha();
Thread oThread = new Thread(new ThreadStart(oAlpha.Beta));
oThread.Priority = ThreadPriority.Highest;
oThread.Start();
oThread.Abort();
Console.WriteLine();
Console.WriteLine("Alpha.Beta has finished");
Console.Read(); return 0;
}
}
}
这段程序怎么理解,我将 oThread.Priority 设为优先级最高,为什么有时输出
Thread Start/Stop/Join SampleAlpha.Beta has finished
Try to restart the Alpha.Beta thread
using System;
using System.Threading;
namespace ThreadTest
{
public class Alpha
{
public void Beta()
{ for (int i = 0; ;i++ )
{ Console.WriteLine("{0}", i); }
}
};
public class Simple
{
public static int Main()
{
Console.WriteLine("Thread Start/Stop/Join Sample");
Alpha oAlpha = new Alpha();
Thread oThread = new Thread(new ThreadStart(oAlpha.Beta));
oThread.Priority = ThreadPriority.Highest;
oThread.Start();
oThread.Abort();
Console.WriteLine();
Console.WriteLine("Alpha.Beta has finished");
Console.Read(); return 0;
}
}
}
这段程序怎么理解,我将 oThread.Priority 设为优先级最高,为什么有时输出
Thread Start/Stop/Join SampleAlpha.Beta has finished
Try to restart the Alpha.Beta thread
解决方案 »
- winform datagridview 默认不选中第一行,试过好几种方法都没效果.
- 从数据库里读数据,怎么只要其中一段
- c#中的SQL Sever 2008已经存在了,还需要从新安装一个吗
- 求一C#.NET开发的PDA程序或者WINDOWS CE程序学习
- 问个隐藏子窗体的办法...
- 有这样一个需求,请各位帮忙给搭建个框架
- reportviewer折线图无法显示?
- 请问怎样使pictureBox控件显示网络上的图片呢?
- 关于异步编程的问题,请大家给点建议。谢谢
- treeview的问题,我的怎么生成不了树啊,是把结点的值横着都列了出来
- 奇怪的问题,项目生成模式的不同居然导致了执行逻辑不同
- MVC 问题
Thread.Join();
oThread.Abort();