Skip to content
Snippets Groups Projects
Commit ab56d9f0 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add a timeout for the searcher.

parent 5d64f8e5
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,10 @@ namespace ATxCommon ...@@ -41,6 +41,10 @@ namespace ATxCommon
try { try {
Log.Trace("Querying WMI for CPU load..."); Log.Trace("Querying WMI for CPU load...");
var searcher = new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor"); var searcher = new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor");
var opts = new EnumerationOptions {
Timeout = new TimeSpan(0, 0, 2)
};
searcher.Options = opts;
Int32 usageInt32 = -1; Int32 usageInt32 = -1;
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment