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