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 編輯過 |
關鍵字查詢
相關文章
正在查詢... |