C# 創(chuàng)建有參、無參數(shù)等多線程操作實例
當前位置:點晴教程→知識管理交流
→『 技術文檔交流 』
C# 多線程操作實例,獲取指定進程的進程詳細信息、獲取指定進程的模塊詳細信息、創(chuàng)建無參數(shù)的多線程應用程序、創(chuàng)建帶參數(shù)的多線程應用程序、創(chuàng)建共享線程模擬資源共享、創(chuàng)建子線程更新主線程數(shù)據(jù)等,部分代碼分享如下: if (MyThread.ThreadState == ThreadState.Terminated) MyData += "\n當前狀態(tài):已完成執(zhí)行并已退出"; if (MyThread.ThreadState == ThreadState.Transition) MyData += "\n當前狀態(tài):在可以執(zhí)行前等待處理器之外的資源"; if (MyThread.ThreadState == ThreadState.Unknown) MyData += "\n當前狀態(tài):狀態(tài)未知"; if (MyThread.ThreadState == ThreadState.Wait) MyData += "\n當前狀態(tài):正在等待外圍操作完成或等待資源釋放"; if (MyThread.WaitReason == ThreadWaitReason.EventPairHigh) MyData += "\n等待原因:線程正在等待事件對高"; if (MyThread.WaitReason == ThreadWaitReason.EventPairLow) MyData += "\n等待原因:線程正在等待事件對低"; if (MyThread.WaitReason == ThreadWaitReason.ExecutionDelay) MyData += "\n等待原因:線程執(zhí)行延遲"; if (MyThread.WaitReason == ThreadWaitReason.Executive) MyData += "\n等待原因:線程正在等待計劃程序"; if (MyThread.WaitReason == ThreadWaitReason.FreePage) MyData += "\n等待原因:線程正在等待可用的虛擬內(nèi)存頁"; if (MyThread.WaitReason == ThreadWaitReason.LpcReceive) MyData += "\n等待原因:線程正在等待本地過程調(diào)用到達"; if (MyThread.WaitReason == ThreadWaitReason.LpcReply) MyData += "\n等待原因:線程正在等待對本地過程調(diào)用的回復到達"; if (MyThread.WaitReason == ThreadWaitReason.PageIn) MyData += "\n等待原因:線程正在等待虛擬內(nèi)存頁到達內(nèi)存"; if (MyThread.WaitReason == ThreadWaitReason.PageOut) MyData += "\n等待原因:線程正在等待虛擬內(nèi)存頁寫入磁盤"; if (MyThread.WaitReason == ThreadWaitReason.Suspended) MyData += "\n等待原因:線程執(zhí)行暫停"; if (MyThread.WaitReason == ThreadWaitReason.SystemAllocation) MyData += "\n等待原因:線程正在等待系統(tǒng)分配"; if (MyThread.WaitReason == ThreadWaitReason.Unknown) MyData += "\n等待原因:線程正在因未知原因而等待"; if (MyThread.WaitReason == ThreadWaitReason.UserRequest) MyData += "\n等待原因:線程正在等待用戶請求"; if (MyThread.WaitReason == ThreadWaitReason.VirtualMemory) MyData += "\n等待原因:線程正在等待系統(tǒng)分配虛擬內(nèi)存"; 附件:threadcs.rar
該文章在 2021/2/4 9:35:15 編輯過 |
關鍵字查詢
相關文章
正在查詢... |