C# 创建有参、无参数等多线程操作实例
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
C# 多线程操作实例,获取指定进程的进程详细信息、获取指定进程的模块详细信息、创建无参数的多线程应用程序、创建带参数的多线程应用程序、创建共享线程模拟资源共享、创建子线程更新主线程数据等,部分代码分享如下: if (MyThread.ThreadState == ThreadState.Terminated) MyData += "\n当前状态:已完成执行并已退出"; if (MyThread.ThreadState == ThreadState.Transition) MyData += "\n当前状态:在可以执行前等待处理器之外的资源"; if (MyThread.ThreadState == ThreadState.Unknown) MyData += "\n当前状态:状态未知"; if (MyThread.ThreadState == ThreadState.Wait) MyData += "\n当前状态:正在等待外围操作完成或等待资源释放"; if (MyThread.WaitReason == ThreadWaitReason.EventPairHigh) MyData += "\n等待原因:线程正在等待事件对高"; if (MyThread.WaitReason == ThreadWaitReason.EventPairLow) MyData += "\n等待原因:线程正在等待事件对低"; if (MyThread.WaitReason == ThreadWaitReason.ExecutionDelay) MyData += "\n等待原因:线程执行延迟"; if (MyThread.WaitReason == ThreadWaitReason.Executive) MyData += "\n等待原因:线程正在等待计划程序"; if (MyThread.WaitReason == ThreadWaitReason.FreePage) MyData += "\n等待原因:线程正在等待可用的虚拟内存页"; if (MyThread.WaitReason == ThreadWaitReason.LpcReceive) MyData += "\n等待原因:线程正在等待本地过程调用到达"; if (MyThread.WaitReason == ThreadWaitReason.LpcReply) MyData += "\n等待原因:线程正在等待对本地过程调用的回复到达"; if (MyThread.WaitReason == ThreadWaitReason.PageIn) MyData += "\n等待原因:线程正在等待虚拟内存页到达内存"; if (MyThread.WaitReason == ThreadWaitReason.PageOut) MyData += "\n等待原因:线程正在等待虚拟内存页写入磁盘"; if (MyThread.WaitReason == ThreadWaitReason.Suspended) MyData += "\n等待原因:线程执行暂停"; if (MyThread.WaitReason == ThreadWaitReason.SystemAllocation) MyData += "\n等待原因:线程正在等待系统分配"; if (MyThread.WaitReason == ThreadWaitReason.Unknown) MyData += "\n等待原因:线程正在因未知原因而等待"; if (MyThread.WaitReason == ThreadWaitReason.UserRequest) MyData += "\n等待原因:线程正在等待用户请求"; if (MyThread.WaitReason == ThreadWaitReason.VirtualMemory) MyData += "\n等待原因:线程正在等待系统分配虚拟内存"; 附件:threadcs.rar
该文章在 2021/2/4 9:35:15 编辑过 |
关键字查询
相关文章
正在查询... |